新建用戶:
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;
授權(quán)用戶數(shù)據(jù)庫權(quán)限:
mysql>grant all privileges on testDB.* to test@localhost identified by '1234';
mysql>flush privileges;
授權(quán)用戶數(shù)據(jù)庫部分權(quán)限:
mysql>grant select,update on testDB.* to test@localhost identified by '1234';
mysql>flush privileges;
授權(quán)用戶遠程登錄:
mysql>grant select,updateon testDB.* to test@"%" identified by '1234';
mysql>flush privileges;