MySQL——修改数据库远程权限

时间:2022-01-11 04:05:56

语句

赋予权限

ON *.*前一个*代表库后一个代表表
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'xxxxx' WITH GRANT OPTION;    

刷新权限

flush PRIVILEGES;

示例

MySQL [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'admin123' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec) MySQL [(none)]> flush PRIVILEGES;
Query OK, 0 rows affected (0.00 sec) //删除远程权限
MySQL [mysql]> delete from mysql.user where user='root' and host='%';