管理用户:
Mysql的用户账号和信息存储在名为'mysql'的Mysql数据库中,因此在进行用户管理的时候,需要先访问它。
mysql> use mysql;
Database changed
mysql数据库中有一个user的表,它包含了所有的账号:
mysql> select user from user;
+------+
| user |
+------+
| root |
添加一个用户;
mysql> create user cactiuser@'192.168.30.25' identified by 'cactiuser';
mysql> flush privileges;
赋予这个用户权限;
mysql> grant all on ultrax.* to cactiuser@'192.168.30.25' identified by 'cactiuser';
mysql> flush privileges;
删除这个用户;
mysql> delete from user where user='cactiuser' and host='%';
mysql> flush privileges;
修改后要生效,相当于刷新user表,
mysql> flush privileges;
修改用户密码:
mysql> UPDATE user SET password=PASSWORD("123") WHERE user='ceshi';
mysql> flush privileges;
转载于:https://blog.51cto.com/cnxb8/710139