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

2024-08-16 10:53:39 浏览数 (1)

语句

赋予权限

?> ON .前一个*代表库后一个代表表

代码语言:javascript复制
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'xxxxx' WITH GRANT OPTION;    

刷新权限

代码语言:javascript复制
flush PRIVILEGES;

示例

代码语言:javascript复制
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='%';

0 人点赞