1.查看配置文件 /etc/my.cnf
[mysqld ]
如果有配置 bin-address =
将 bind-address = 注释
2.使用root 进入mysql
#use mysql;
#select host,user from user;
查看是否有'%' 的host ,如果没有则添加

3.添加host
语法: grant [权限] on[数据库].[表] to [用户]@[host] identified by[密码]
#grant all on *.* to root@'%' identified by 'password'
到这一步就差不多了。如果还是访问不了,可以使防火墙没有关闭
4.查看,关闭防火墙
查看防火墙设置

关闭防火墙
#service ip6tables stop
#service iptables stop
本文介绍如何配置MySQL以允许远程连接,包括修改配置文件、授予用户权限、检查并关闭防火墙等步骤。
1万+

被折叠的 条评论
为什么被折叠?



