时间戳转换工具

详细记录了是如何一步一步排查mysql拒绝连接的问题。

正文:

1. 从远程定位问题

ping ip : 检测机器是否可以连的通
telnet ip port : 检测端口是否有开放


2. 从机器内部定位

1. 查看mysql服务是否开启
ps -ef|grep mysqld
2. 查看tcp端口是否开启
netstat -tnpl
3. 查看mysql是否指定了bind-address
vim /etc/mysql/my.cnf
4. 查看mysql的账号是否允许外部连接(需要重启mysql:/etc/init.d/mysqld restart)
mysql -u root -p
use mysql
select user,host from user;
update user set host=‘%’ where user=‘root’;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
5. 查看防火墙是否开启3306端口
iptables -S
/sbin/iptables -I INPUT -p tcp --dport 8011 -j ACCEPT #开启8011端口
/etc/init.d/iptables restart


联系我们 - 首页 - 关于我们
Copyright © 2017-2022 iteam. All Rights Reserved. Current version is 2.50.0.
粤ICP备17021424号
VV:46373 UV:165285 PV:515435