CentOS下配置MySQL允许root用户远程登录

# root用户登录
$ mysql -u root -p

# 切换到mysql这个数据库
mysql> use mysql;

# 查看root用户配置
mysql> select host,user from user where user='root';

如果查询结果中不包含以下记录,请添加,否则请忽略次步骤

host    user
%   root
mysql> update user set host = '%' where user = 'root' and host='127.0.0.1';

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

 flush privileges;

发表评论

邮箱地址不会被公开。 必填项已用*标注