mySql服务器3306端口不能远程连接以及Linux连接mysql报错的问题解决
1.端口检测 命令:netstat -ntpl |grep 3306 结果:tcp 0 0 :::3306 结果说明:::3306只监听本地址,出现0.0.00::3306表示监听所有地址 2.防火墙开启3306端口 vi /etc/sysconfig/iptables -A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT(允许3306端口通过防火墙) /etc/init.d/iptables restart(重启防火墙使配置生效) 3.配置好之后可能会出现Linux连接mysql报错 (1)先停止mysql服务 service mysql stop (2)进入mysql安装目录bin/ 使用safe模式,进行重启: ./mysqld_safe --skip-grant-tables (3)使用root账户,无密码登录,修改root用户密码 mysql -u root use mysql update user set password=PASSWORD(“你的密码”) where User = ‘root’; (4)service mysqld restart 重启 4.连接成功。