MySQL错误:Can't connect to MySQL server (10060)
程序员文章站
2022-05-16 14:10:02
...
当远程连接MySQL数据库的时候显示Can
当远程连接MySQL数据库的时候显示Can't connect to MySQL server (10060),我们从以下几个方面入手,找出错误的原因:
1.网络不通。
检查能不能ping通。
2.防火墙设置。
防火墙是否放过mysql的进程,是否屏蔽了mysql的3306端口。
3.mysql的账户设置。
mysql账户是否不允许远程连接。如果无法连接可以尝试以下方法:
mysql -u root -p //登录MySQL
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION; //任何远程主机都可以访问数据库
mysql> FLUSH PRIVILEGES; //需要输入次命令使修改生效
mysql> EXIT //退出
也可以通过修改表来实现远程:
mysql -u root -p
mysql> use mysql;
mysql> update user set host = '%' where user = 'root';
mysql> select host, user from user;
,上一篇: 十个 PHP 开发者最容易犯的错误
推荐阅读
-
连接Mysql错误 error 1042 can't get hostname for your address
-
连接Mysql提示Can’t connect to local MySQL server through socket的解决方法
-
MYSQL ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.10.210' (111) 解决方法
-
MySQL连接错误:Can't connect to MySQL server on'localhost' (10055)
-
MySQL错误 ERROR 2002 (HY000): Can't connect to local MySQL server through socket 的解决办法
-
windows 连接 linux 上的mysql出现Can't connect to; is not allowed to connect;Access denied for user
-
连接Mysql错误 error 1042 can't get hostname for your address
-
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)解决办法
-
Can't connect to local MySQL server through socket
-
Can't connect to MySQL server on 'localhost' (10061)问题描述及解决办法