- 创建用户
$ mysql -uroot -hlocalhost -prootmysql> insert into mysql.user(Host,User,Password) values("localhost","ice",password("icepasswd"));mysql> flush privileges; # 刷新系统权限表
- 给用户授权
mysql> grant select on db_name.* to ice@localhost identified by "icepasswd"mysql> flush privileges;
- 修改用户密码
mysql> update mysql.user set password=password("新密码") where User="ice" and Host="localhost";mysql> flush privileges;
- 删除用户
$ mysql -uroot -hlocalhost -prootmysql> use mysqlmysql> delete from user where User="ice" and Host="localhost"mysql> flush privileges;