5 月 072016
 

查询用户和权限

mysql> select * from mysql.user\G;

mysql> select * from mysql.user where user='root' \G;

mysql> show grants for root\G;

创建用户

mysql>use mysql;

mysql>insert into mysql.user(Host,User,Password) values("localhost","test",password("1234"));

删除用户

mysql>use mysql;

mysql>Delete FROM user Where User='test' and Host='localhost';

mysql>flush privileges;

修改密码

mysql>update mysql.user set password=password('newpwd') where User="test" and Host="localhost";

mysql>flush privileges;