错误2003 (HY000):无法连接到本地主机的MySQL服务器(10061)

时间:2023-01-27 00:25:12

I installed MySQL on Microsoft Windows 8 Using a noinstall Zip Archive. But when i tested by executing the following commands on windows prompt, the above error showed up.

我在微软的Windows 8上安装了MySQL,使用的是noinstall Zip归档文件。但是当我在windows提示符上执行以下命令进行测试时,上面的错误出现了。

C:\> "C:\MySQL\bin\mysqlshow" 

C:\> "C:\MySQL\bin\mysql" test

Please help me.

请帮助我。

14 个解决方案

#1


44  

You don't need to restart your windows. The easiest way to achieve this is

您不需要重新启动windows。最简单的方法是

  1. Goto /bin/
  2. Goto /bin/
  3. Run mysqld (service)
  4. 运行mysqld(服务)
  5. close the cmd prompt
  6. 关闭cmd提示
  7. Run mysql.exe or the better way to do is add the location to PATH environment Variable
  8. 运行mysql。exe或更好的方法是将位置添加到PATH环境变量中

Thanks

谢谢

#2


11  

Go to Run type services.msc. Check whether MySQL services is running or not. If not, start it manually. Once it started, type mysqlshow to test the service.

转到运行类型服务。检查MySQL服务是否正在运行。如果不是,请手动启动它。一旦启动,输入mysqlshow来测试服务。

#3


5  

i also face the same problem. try it

我也面临同样的问题。试一试

  1. Go to bin directory copy the path and set it as a environment variable.
  2. 转到bin目录复制路径并将其设置为环境变量。
  3. Run the command prompt as admin and cd to bin directory:
  4. 以admin和cd的形式运行命令提示符到bin目录:
  5. Run command : mysqld –install
  6. 运行命令:sqmyld -install
  7. Now the services are successfully installed
  8. 现在已经成功安装了服务。
  9. Start the service in service windows of os
  10. 在操作系统的服务窗口中启动服务。
  11. Type mysql and go
  12. 类型mysql和去

#4


4  

Though it is an old question, I am adding my answer in it, because the solution that worked for me on Windows 7 as an admin user, is missing in the answers' list. Though my solution is for installed MySQL, I am putting it for those who search for a solution for this error message. Here it is:

虽然这是一个老问题,但我还是在里面加上了我的答案,因为在Windows 7上作为一个管理员,我的解决方案在答案列表中没有。虽然我的解决方案是安装MySQL,但我将它用于那些为这个错误消息寻找解决方案的人。这里是:

  1. Click on the Windows 7 start button and type taskmgr in the search bar
  2. 单击Windows 7 start按钮,在搜索栏中输入taskmgr
  3. Right click on the taskmgr program icon and select Run as administrator
  4. 右键单击taskmgr程序图标,选择Run as administrator
  5. In the Task Manager window, go to the Services tab
  6. 在任务管理器窗口中,转到Services选项卡
  7. Right click on the MySQL service and click Start Service
  8. 右键单击MySQL服务并单击Start服务。
错误2003 (HY000):无法连接到本地主机的MySQL服务器(10061) 错误2003 (HY000):无法连接到本地主机的MySQL服务器(10061)

#5


3  

I have a windows 8.1 machine and mysql was not running at all even after trying to start mysqld with no error logs. This solution worked for me:

我有一台windows 8.1机器,而且mysql在尝试启动mysqld时没有错误日志之后也没有运行。这个解决方案对我起了作用:

  1. start cmd in admin mode
  2. 在管理模式下启动cmd
  3. type in "net start mysql"
  4. 输入“net start mysql”
  5. close current cmd window and open new cmd window
  6. 关闭当前的cmd窗口并打开新的cmd窗口
  7. type in "mysql"
  8. 输入“mysql”

The mysqld service should now be available.

mysqld服务现在应该是可用的。

#6


2  

Test if the server is running. You can use netstat for this. See https://serverfault.com/questions/260239/unable-to-connect-to-mysql-through-port-3306

测试服务器是否正在运行。你可以使用netstat。见https://serverfault.com/questions/260239/unable - -连接到mysql -通过端口3306

If it is running, it may be the firewall. You can turn that off to test if that is the problem.

如果它正在运行,它可能是防火墙。如果这是问题,你可以关闭它来测试。

See the following manual to install Mysql as a service: https://dev.mysql.com/doc/refman/5.5/en/windows-start-service.html

请参阅以下安装Mysql作为服务的手册:https://dev.mysql.com/doc/refman/5.5/ en/windowsstart -service.html

#7


2  

Hey this is not a big issue what you need to do is.....

嘿,这不是什么大问题你需要做的是……

1. Run your cmd as administrator.

2.What you will see is like this
c:\windows\system32>

3.Go to your bin location by using cd..
like C:\mysql\bin(my location of bin in my computer is what you are seeing so chose yours correctly)

4.C:\mysql\bin>mysql --install
  Service successfully installed.

5.C:\mysql\bin>NET START MySql
 The MySql service is starting
 The MySql service was started successfully

Then last step is

最后一步是

6.C:\mysql\bin>mysql -u root - p admin
It will ask for password don't enter anything first time because it will use blank, n just press enter you are done.

N later you can set password too...:)

之后你也可以设置密码…

#8


1  

Well that could have some reasons.

这可能是有原因的。

THe first one is that the MySQL server/service not started.

第一个是MySQL服务器/服务没有启动。

If he is started you should check out the logfiles, and make sure there are no problems.

如果他已经启动,您应该检查日志文件,并确保没有问题。

You could also uninstall the MySQL service and install XAMPP. With XAMPP it is easier to manage this services.

还可以卸载MySQL服务并安装XAMPP。使用XAMPP可以更容易地管理这些服务。

#9


1  

If you're using the no install zip, you need to execute mysqld.exe first to start the service, and then execute mysql.exe to open your connection.

如果使用no install zip,则需要执行mysqld。exe首先启动服务,然后执行mysql。打开你的连接。

The no install is nice, but if you intend to do any serious work with MySQL, you may want to consider either using the MSI to do a proper installation, or if you're doing web development work give XAMPP a try.

no安装是很好的,但是如果您打算使用MySQL进行任何认真的工作,您可能需要考虑使用MSI进行适当的安装,或者如果您正在进行web开发工作,请尝试XAMPP。

#10


1  

Check Mysqld.exe file is in your bin folder. if it is not there , just copy that file from any other computer and paste it on your bin folder.Just double click. Then run mysql.its solved

检查Mysqld。exe文件在您的bin文件夹中。如果它不在那里,只需从任何其他计算机复制该文件并粘贴到您的bin文件夹。双击。然后运行mysql。它解决了

#11


1  

I was stuck on this same issue for what felt like an eternity.

我被困在了同样的问题上,感觉像是永远。

My problem was: I was running mysql from MAMP on port 8889, but when trying to connect to mysql from my command line, it was expecting port 3306. I was running out of ideas, so I tried:

我的问题是:我在8889端口上从MAMP运行mysql,但是当试图从我的命令行连接到mysql时,它期望端口3306。我的想法没了,所以我试着:

mysql --port 8889

mysql——端口8889

and happiness ensued:

和幸福随之而来:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.34-log MySQL Community Server (GPL)

#12


1  

This happened to me too! But I accidentally found out that execute the 'mysqld' command can solve your problem.

这也发生在我身上!但是我偶然发现执行“mysqld”命令可以解决您的问题。

My SQL version is 5.7. Hope this works for you.

我的SQL版本是5.7。希望这对你有用。

#13


1  

I have tried all the above mentioned options but can not find the solution to this problem . Then I got its solution.... This error is flashed when we are trying to open mysql with out stating the service. Follow the bellow mentioned steps..
STEP 1
Open cmd prompt
to start the service type
mysqld --console this will start the mysql service
enter image description here
STEP 2 dont close this cmd prompt
now open new cmd prompt and type
mysql -u root -p
then enter ur password
enter image description here

我已经尝试了上面提到的所有选项,但是没有找到这个问题的解决方案。然后我得到了它的解决方案....当我们试图打开mysql而不声明服务时,会出现此错误。遵循下面提到的步骤。步骤1打开cmd提示符以启动服务类型mysqld——控制台这将启动mysql服务输入图像描述这里步骤2不要关闭cmd提示符现在打开新的cmd提示符,输入mysql -u root -p,然后在这里输入您的密码输入图像描述

#14


0  

I had the same problem. I tried all of the answers above (and some from other websites). In the end, my issue was that my cache wasn't configured. I found that info in my error log and fixed it by changing the line in the file:

我也有同样的问题。我尝试了上面所有的答案(还有其他网站的一些)。最后,我的问题是我的缓存没有配置。我在我的错误日志中找到了这个信息,通过修改文件中的行来修正:

C:\MAMP\bin\apache\conf\extra\http-ssl.conf

C:\ MAMP \ bin \ apache \ conf \额外\ http-ssl.conf

There I removed the double quotes from the line:

在那里,我去掉了行中的双引号:

SSLSessionCache "shmcb:/some/example/path/ssl_scache(512000)"

SSLSessionCache“shmcb:/ /例子/道路/ ssl_scache(512000)“

to:

:

SSLSessionCache shmcb:/some/example/path/ssl_scache(512000)

SSLSessionCache shmcb:/ /例子/道路/ ssl_scache(512000)

and saved with Ctrl+S and closed the file.

用Ctrl+S保存并关闭文件。

Here's the link that helped me: https://wiki.apache.org/httpd/SSLSessionCache

下面是帮助我的链接:https://wiki.apache.org/httpd/SSLSessionCache。

#1


44  

You don't need to restart your windows. The easiest way to achieve this is

您不需要重新启动windows。最简单的方法是

  1. Goto /bin/
  2. Goto /bin/
  3. Run mysqld (service)
  4. 运行mysqld(服务)
  5. close the cmd prompt
  6. 关闭cmd提示
  7. Run mysql.exe or the better way to do is add the location to PATH environment Variable
  8. 运行mysql。exe或更好的方法是将位置添加到PATH环境变量中

Thanks

谢谢

#2


11  

Go to Run type services.msc. Check whether MySQL services is running or not. If not, start it manually. Once it started, type mysqlshow to test the service.

转到运行类型服务。检查MySQL服务是否正在运行。如果不是,请手动启动它。一旦启动,输入mysqlshow来测试服务。

#3


5  

i also face the same problem. try it

我也面临同样的问题。试一试

  1. Go to bin directory copy the path and set it as a environment variable.
  2. 转到bin目录复制路径并将其设置为环境变量。
  3. Run the command prompt as admin and cd to bin directory:
  4. 以admin和cd的形式运行命令提示符到bin目录:
  5. Run command : mysqld –install
  6. 运行命令:sqmyld -install
  7. Now the services are successfully installed
  8. 现在已经成功安装了服务。
  9. Start the service in service windows of os
  10. 在操作系统的服务窗口中启动服务。
  11. Type mysql and go
  12. 类型mysql和去

#4


4  

Though it is an old question, I am adding my answer in it, because the solution that worked for me on Windows 7 as an admin user, is missing in the answers' list. Though my solution is for installed MySQL, I am putting it for those who search for a solution for this error message. Here it is:

虽然这是一个老问题,但我还是在里面加上了我的答案,因为在Windows 7上作为一个管理员,我的解决方案在答案列表中没有。虽然我的解决方案是安装MySQL,但我将它用于那些为这个错误消息寻找解决方案的人。这里是:

  1. Click on the Windows 7 start button and type taskmgr in the search bar
  2. 单击Windows 7 start按钮,在搜索栏中输入taskmgr
  3. Right click on the taskmgr program icon and select Run as administrator
  4. 右键单击taskmgr程序图标,选择Run as administrator
  5. In the Task Manager window, go to the Services tab
  6. 在任务管理器窗口中,转到Services选项卡
  7. Right click on the MySQL service and click Start Service
  8. 右键单击MySQL服务并单击Start服务。
错误2003 (HY000):无法连接到本地主机的MySQL服务器(10061) 错误2003 (HY000):无法连接到本地主机的MySQL服务器(10061)

#5


3  

I have a windows 8.1 machine and mysql was not running at all even after trying to start mysqld with no error logs. This solution worked for me:

我有一台windows 8.1机器,而且mysql在尝试启动mysqld时没有错误日志之后也没有运行。这个解决方案对我起了作用:

  1. start cmd in admin mode
  2. 在管理模式下启动cmd
  3. type in "net start mysql"
  4. 输入“net start mysql”
  5. close current cmd window and open new cmd window
  6. 关闭当前的cmd窗口并打开新的cmd窗口
  7. type in "mysql"
  8. 输入“mysql”

The mysqld service should now be available.

mysqld服务现在应该是可用的。

#6


2  

Test if the server is running. You can use netstat for this. See https://serverfault.com/questions/260239/unable-to-connect-to-mysql-through-port-3306

测试服务器是否正在运行。你可以使用netstat。见https://serverfault.com/questions/260239/unable - -连接到mysql -通过端口3306

If it is running, it may be the firewall. You can turn that off to test if that is the problem.

如果它正在运行,它可能是防火墙。如果这是问题,你可以关闭它来测试。

See the following manual to install Mysql as a service: https://dev.mysql.com/doc/refman/5.5/en/windows-start-service.html

请参阅以下安装Mysql作为服务的手册:https://dev.mysql.com/doc/refman/5.5/ en/windowsstart -service.html

#7


2  

Hey this is not a big issue what you need to do is.....

嘿,这不是什么大问题你需要做的是……

1. Run your cmd as administrator.

2.What you will see is like this
c:\windows\system32>

3.Go to your bin location by using cd..
like C:\mysql\bin(my location of bin in my computer is what you are seeing so chose yours correctly)

4.C:\mysql\bin>mysql --install
  Service successfully installed.

5.C:\mysql\bin>NET START MySql
 The MySql service is starting
 The MySql service was started successfully

Then last step is

最后一步是

6.C:\mysql\bin>mysql -u root - p admin
It will ask for password don't enter anything first time because it will use blank, n just press enter you are done.

N later you can set password too...:)

之后你也可以设置密码…

#8


1  

Well that could have some reasons.

这可能是有原因的。

THe first one is that the MySQL server/service not started.

第一个是MySQL服务器/服务没有启动。

If he is started you should check out the logfiles, and make sure there are no problems.

如果他已经启动,您应该检查日志文件,并确保没有问题。

You could also uninstall the MySQL service and install XAMPP. With XAMPP it is easier to manage this services.

还可以卸载MySQL服务并安装XAMPP。使用XAMPP可以更容易地管理这些服务。

#9


1  

If you're using the no install zip, you need to execute mysqld.exe first to start the service, and then execute mysql.exe to open your connection.

如果使用no install zip,则需要执行mysqld。exe首先启动服务,然后执行mysql。打开你的连接。

The no install is nice, but if you intend to do any serious work with MySQL, you may want to consider either using the MSI to do a proper installation, or if you're doing web development work give XAMPP a try.

no安装是很好的,但是如果您打算使用MySQL进行任何认真的工作,您可能需要考虑使用MSI进行适当的安装,或者如果您正在进行web开发工作,请尝试XAMPP。

#10


1  

Check Mysqld.exe file is in your bin folder. if it is not there , just copy that file from any other computer and paste it on your bin folder.Just double click. Then run mysql.its solved

检查Mysqld。exe文件在您的bin文件夹中。如果它不在那里,只需从任何其他计算机复制该文件并粘贴到您的bin文件夹。双击。然后运行mysql。它解决了

#11


1  

I was stuck on this same issue for what felt like an eternity.

我被困在了同样的问题上,感觉像是永远。

My problem was: I was running mysql from MAMP on port 8889, but when trying to connect to mysql from my command line, it was expecting port 3306. I was running out of ideas, so I tried:

我的问题是:我在8889端口上从MAMP运行mysql,但是当试图从我的命令行连接到mysql时,它期望端口3306。我的想法没了,所以我试着:

mysql --port 8889

mysql——端口8889

and happiness ensued:

和幸福随之而来:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.34-log MySQL Community Server (GPL)

#12


1  

This happened to me too! But I accidentally found out that execute the 'mysqld' command can solve your problem.

这也发生在我身上!但是我偶然发现执行“mysqld”命令可以解决您的问题。

My SQL version is 5.7. Hope this works for you.

我的SQL版本是5.7。希望这对你有用。

#13


1  

I have tried all the above mentioned options but can not find the solution to this problem . Then I got its solution.... This error is flashed when we are trying to open mysql with out stating the service. Follow the bellow mentioned steps..
STEP 1
Open cmd prompt
to start the service type
mysqld --console this will start the mysql service
enter image description here
STEP 2 dont close this cmd prompt
now open new cmd prompt and type
mysql -u root -p
then enter ur password
enter image description here

我已经尝试了上面提到的所有选项,但是没有找到这个问题的解决方案。然后我得到了它的解决方案....当我们试图打开mysql而不声明服务时,会出现此错误。遵循下面提到的步骤。步骤1打开cmd提示符以启动服务类型mysqld——控制台这将启动mysql服务输入图像描述这里步骤2不要关闭cmd提示符现在打开新的cmd提示符,输入mysql -u root -p,然后在这里输入您的密码输入图像描述

#14


0  

I had the same problem. I tried all of the answers above (and some from other websites). In the end, my issue was that my cache wasn't configured. I found that info in my error log and fixed it by changing the line in the file:

我也有同样的问题。我尝试了上面所有的答案(还有其他网站的一些)。最后,我的问题是我的缓存没有配置。我在我的错误日志中找到了这个信息,通过修改文件中的行来修正:

C:\MAMP\bin\apache\conf\extra\http-ssl.conf

C:\ MAMP \ bin \ apache \ conf \额外\ http-ssl.conf

There I removed the double quotes from the line:

在那里,我去掉了行中的双引号:

SSLSessionCache "shmcb:/some/example/path/ssl_scache(512000)"

SSLSessionCache“shmcb:/ /例子/道路/ ssl_scache(512000)“

to:

:

SSLSessionCache shmcb:/some/example/path/ssl_scache(512000)

SSLSessionCache shmcb:/ /例子/道路/ ssl_scache(512000)

and saved with Ctrl+S and closed the file.

用Ctrl+S保存并关闭文件。

Here's the link that helped me: https://wiki.apache.org/httpd/SSLSessionCache

下面是帮助我的链接:https://wiki.apache.org/httpd/SSLSessionCache。