Skip to content

linux mysql 配置远程连接数据库

1.为 root 用户增加权限 grant all privileges on . to ‘root’@’%’ identified by ‘unisk.88’ with grant option; flush privileges; 2.设置防火墙允许 3306 端口 /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT #开启 3306 端口 service iptables save #保存防火墙规则 service iptables restart #重置防火墙规则 cat /etc/sysconfig/iptables #查看防火墙 3.配置端口 netstat -anp(查看所有的进程和端口使用情况) 如果不是 0.0.0.0:3306 0.0.0.0:*则 vi /etc/my.cnf [mysqld]增加 bind-address = 0.0.0.0 service mysql restart

最近更新