无法在窗口 7 上的本地主机(10061)上连接到 MySQL 服务器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6599524/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 20:24:16  来源:igfitidea点击:

Can't connect to MySQL server on localhost (10061) on window 7

mysqlwindows-7mysql-error-2003

提问by R. Rahul

I am having window 7 as a operating system in the production machine where i am trying to use MySQL server 5.0 as a database. But i am unable to configure MySQL on my production machine. Following is the error i am receiving.

我在生产机器中使用 windows 7 作为操作系统,我试图在其中使用 MySQL 服务器 5.0 作为数据库。但是我无法在我的生产机器上配置 MySQL。以下是我收到的错误。

The security setting could not be applied to the database because the connection has failed with the following error:

无法将安全设置应用于数据库,因为连接失败并出现以下错误:

Error no. 2003
Can't connect to MySQL server on localhost (10061).

错误编号 2003
无法连接到本地主机上的 MySQL 服务器 (10061)。

The message also prompts that you need to open TCP 3306 port to resolve this issue, i checked it and found that TCP 3306 port is already opened and state is listening.

该消息还提示您需要打开TCP 3306端口来解决此问题,我查看了它,发现TCP 3306端口已经打开并且状态为侦听。

This is my 'netstat -an' command result -

这是我的“netstat -an”命令结果 -

Proto   LocalAddress   ForeignAddress   State
TCP     0.0.0.0:3306      0.0.0.0:0           LISTENING

Proto LocalAddress ForeignAddress State
TCP 0.0.0.0:3306 0.0.0.0:0监听

It means TCP at 3306 is open. Can anyone please tell me the solution of this problem. However i am able to install and configure the same MySQL Server setup in window xp. I tried google as well and found a lot of blogs but none is of use.

这意味着 3306 处的 TCP 是打开的。谁能告诉我这个问题的解决方案。但是,我能够在 windows xp 中安装和配置相同的 MySQL 服务器设置。我也试过谷歌,发现了很多博客,但没有一个有用。

Thanks a lot.

非常感谢。

回答by stevedbrown

Change

改变

 host: localhost

to

 host: 127.0.0.1

This is likely caused by the way your database is being resolved.

这可能是由您的数据库的解析方式引起的。

回答by QMP

have you checked whether the port 3036 is already in use by another application? Have you checked whether a telnet hostname3036 works on the local MySQL server and also on the remote machine?

您是否检查过端口 3036 是否已被其他应用程序使用?您是否检查过 telnet hostname3036是否在本地 MySQL 服务器和远程机器上工作?

回答by Akshay

First check in the system, MySQL services is in running condition or not. look out on path of services go to right click on My Computer > manage > Services and Application > Services and check MySQL service status is started or not. Otherwise right click on service and start to service.

首先在系统中检查MySQL服务是否处于运行状态。查看服务路径,右键单击“我的电脑”>“管理”>“服务和应用程序”>“服务”,然后检查 MySQL 服务状态是否已启动。否则右键单击服务并开始服务。

I hope this will help you.

我希望这能帮到您。

回答by C R Naik

I didn't find the MySQL serviceseven after solving the problem.
I just run the mysqldas administratorand the problem is solved. So, simple but It took me 3 hours to find the solution.

即使解决了问题,我也没有找到MySQL服务
我只是mysqld管理员身份运行,问题就解决了。所以,很简单,但我花了 3 个小时才找到解决方案。

回答by Enda

The problem was rsolved. The MySQL was not running in the Services section of Settings. Because XAMMP had disconnected the already running application in the background.

问题解决了。MySQL 未在“设置”的“服务”部分运行。因为 XAMMP 已经在后台断开了已经运行的应用程序。