新建用户:
mysql>use mysql;
mysql>insert into user(user,host,authentication_string) values('test','%',password('1234'));
mysql>flush privileges;
退出登录试验一下。
修改用户密码:
mysql>use mysql;
mysql>update user set authentication_string=password('123456') where user='test';
mysql>flush privileges;
删除用户:
mysql>use mysql;
mysql>delete from user where user='test' and host='localhost';
mysql>flush privileges;
授权用户数据库权限:
mysql>grant all privileges on testDB.* to test@localhost identified by '1234';
mysql>flush privileges;
授权用户数据库部分权限:
mysql>grant select,update on testDB.* to test@localhost identified by '1234';
mysql>flush privileges;
授权用户远程登录:
mysql>grant select,updateon testDB.* to test@"%" identified by '1234';
mysql>flush privileges;