use mysql;
// 修改一條 root 數(shù)據(jù),并刷新MySQL的系統(tǒng)權(quán)限相關(guān)表
update user set Host = '%' where Host = 'localhost' and User = 'root';
flush privileges;
// grant 命令重新創(chuàng)建一個用戶
grant all privileges on *.* to root@"%" identified by "root";
添加用戶授權(quán)(不會覆蓋之前的權(quán)限)
grant all privileges on *.* to 'username'@'%' identified by '密碼' with grant option;
添加權(quán)限(和已有權(quán)限合并,不會覆蓋已有權(quán)限)
GRANT Insert ON `your database`.* TO `user`@`host`;
刪除權(quán)限
REVOKE Delete ON `your database`.* FROM `user`@`host`;
flush privileges;
本文摘自 :https://www.cnblogs.com/