Centos下Mysql授权root远程访问

2020-03-31 / 185 阅读 / Linux

经常用到,搜索结果又千奇百怪,特此记录操作命令:

授权远程访问操作

1、命令行进入Mysql,紧随输入root密码
mysql -uroot -p
2.切换mysql
use mysql;
3.执行授权语句
grant all privileges on *.* to 'root'@'%' identified by 'password';
4.刷新配置
flush privileges;

取消授权远程访问操作:

use mysql;

revoke all privileges on *.* from 'root'@'%';

flush privileges;
相关推荐