1、检查你的mysql服务是否已经启动 2、用127.0.0.1替换localhost来试试看 3、检查mysql的端口是否3306,telnet是否通 关闭:chkconfig iptables off 关闭 selinux : vi /etc/sysconfig/selinux 查看 selinux 状态 getenforce 4、''@localhost记录的影响(用户名是空,主机字段是localhost的记录影响了) delete mysql.user where user = ''; 以后,service mysqld restart 重启mysql
转载于:https://blog.51cto.com/zhuqianwei/1439128