错误号 2003. 无法连接到 mysql 服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19727432/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error No. 2003. Can't connect to mysql server
提问by Sterling Diaz
I has had two days searching and exploring solutions regarding the error 2003. Can't connect to mysql server on 'Server name'.
我花了两天时间搜索和探索有关 2003 错误的解决方案。无法连接到“服务器名称”上的 mysql 服务器。
The firewall is off and I had added the port 3306, the one that mysql uses.
防火墙关闭,我添加了端口 3306,这是 mysql 使用的端口。
Any recommendation?
有什么推荐吗?
回答by Sathish D
Please refer this FAQ which describes how to solve this issue: http://faq.webyog.com/content/23/15/en/error-no-2003-can_t-connect.html
请参阅此常见问题解答,其中描述了如何解决此问题:http: //faq.webyog.com/content/23/15/en/error-no-2003-can_t-connect.html
Error No. 2003: Can't connect to MySQL server on 'localhost' (or some other host)
错误号 2003:无法连接到“本地主机”(或其他主机)上的 MySQL 服务器
simply means that connection is not possible for one of the following (or similar) reasons:
仅表示由于以下(或类似)原因之一无法连接:
There is no MySQL server running at the specified host
Connection to the MySQL server is not allowed using TCP-IP. Check the 'skip-networking' setting in the MySQL configuration file (my.ini on Windows, my.cnf on Unix/Linux). It shall be commented out like '#skip-networking'. If it is not commented out, then do it and restart the MySQL server for the change to take effect. SQLyog needs to connect using TCP-IP.
Some networking issue prevents connection. It could be a network malconfiguration or a firewall issue.
When trying to connect to a MySQL server at an ISP this error message often indicates that direct connection to MySQL has been blocked. You must then use HTTP-tunneling or SSH-tunneling to connect.
指定主机上没有运行 MySQL 服务器
不允许使用 TCP-IP 连接到 MySQL 服务器。检查 MySQL 配置文件(Windows 上的 my.ini,Unix/Linux 上的 my.cnf)中的“skip-networking”设置。它应该像'#skip-networking'一样被注释掉。如果没有注释掉,那么做并重新启动MySQL服务器以使更改生效。SQLyog 需要使用 TCP-IP 进行连接。
一些网络问题阻止连接。这可能是网络配置错误或防火墙问题。
当尝试连接到 ISP 处的 MySQL 服务器时,此错误消息通常表明与 MySQL 的直接连接已被阻止。然后,您必须使用 HTTP 隧道或 SSH 隧道进行连接。
回答by Mithun Debnath
It worked for me.controll pannel->administrative tools->services->mysql and start mysql.Some times simple solution saves lot of time.
它对我有用。控制面板->管理工具->服务->mysql并启动mysql。有时简单的解决方案可以节省大量时间。
回答by napster
i have the same issue but i fix it. my hostname is DEBIAN, i just modify the file my.cnf ( for mysql) and set bindaddress : 0.0.0.0
我有同样的问题,但我修复了它。我的主机名是 DEBIAN,我只是修改文件 my.cnf(用于 mysql)并设置 bindaddress:0.0.0.0
this option say to mysql to listen all interfaces. restart your server and finish
此选项告诉 mysql 侦听所有接口。重新启动您的服务器并完成
回答by shreesh katti
The SQL Sever might not be installed. Please refer this to install: [MySQL][1]https://dev.mysql.com/downloads/installer/
可能未安装 SQL 服务器。请参考此安装:[MySQL][1] https://dev.mysql.com/downloads/installer/
回答by Indra Darmawan
if your question refer to can't connect to mysql on hosting (cpanel), i also had same problem. I also turn off firewall, but it doesn't solve my problem. Rather than using server name or domain name on Mysql Host Address, i using ip address given by hosting provider. And it works.
如果您的问题是指无法在托管(cpanel)上连接到 mysql,我也遇到了同样的问题。我也关闭了防火墙,但它并没有解决我的问题。我没有在 Mysql 主机地址上使用服务器名称或域名,而是使用托管服务提供商提供的 IP 地址。它有效。
回答by Sundar Gautam
Going to services and starting MYSQL service doesn't work for me. Finally, I hit the following commands inside the MYSQL command-line client: ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
转到服务并启动 MYSQL 服务对我不起作用。最后,我在 MYSQL 命令行客户端中执行以下命令: ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
回答by Akhil das
normally means that there is no MySQL server running on the system . check your server running
通常意味着系统上没有运行 MySQL 服务器。检查您的服务器正在运行
回答by user1397770
this could be due to firewalls of the system try below command and check
这可能是由于系统的防火墙尝试以下命令并检查
service iptables stop
服务 iptables 停止
回答by Esam Naas
Unless you are using other system
除非你使用其他系统
Please follow theses instructions
try to use wampserver to test your code
尝试使用 wampserver 来测试您的代码