mysql文档学习3.6
远程登录 -h IP地址
ctrl + d 退出 或 \q 或 quit
select version(); 当前版本
current_date当前日期 或curdate() 或 current_date()
SELECT name, birth, curdate(),(year(curdate())-year(birth)) - (right(curdate(),5)<right(birth,5)) as age from 表 ORDER BY name;
year 提取年部分 right(curdate(),5)提取右面的5位
month()月 month(curdate())
day() 天 或dayofmonth 意思是拿月来说的天数
dayofyear() 拿年来说的天
select date_add(curdate(),interval 1 year);
interval(间隔的意思) date_add 时间相加的函数
interval 数字 year或者month
mod(month(curdate()),12)
mod的意思也没用怎么明白! 意思就是前一个值是5,后面指定前面的参数最大是多少
now() 当前时间
user() 当前用户及链接地址
\c 重新开始
select distinct name from test;
distinct 去掉重复字段
order by 排序
binary(二进制意思) 强制区分大小写
相关文档:
2009-05-05
打开MySQL远程访问权限
关键字: mysql
1、改表法
可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
mysql -u root -p
mysql>use mysql;
mysql>upda ......
#include "winsock.h"
#include "mysql.h"
void query_example(void)
{
MYSQL *pDbCon = NULL;
char *pszHost = "localhost";
char *pszUser = "guest";
char *pszPsw = "";
char *pszDbName = "mysql_db_name";
int iPort = 3306;
pDbCon = mysql_init((MYSQL*) 0);
if (NULL != pDbCon)
{
......
mysql字符集设置和查询问题(转)
2010-04-14 11:33
MySQL的字符集支持(Character Set Support)有两个方面:
字符集(Character set)和排序方式(Collation)。
对于字符集的支持细化到四个层次:
服务器(server),数据库(database),数据表(table)和连接(connection) ......