无法连接到“127.0.0.1”上的 MySQL 服务器 (10061) (2003)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24525736/
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
Can't connect to MySQL server on '127.0.0.1' (10061) (2003)
提问by Zee E.
I know this question was asked a lot before but I tried some of the solutions which were given and nothing worked..
我知道这个问题以前被问过很多次,但我尝试了一些给出的解决方案,但没有任何效果。
I have downloaded MySQL Workbench 6.1 on my windows 7 x64and now as I want to start and do a simple DB I set a new MySQL Connection and let it as default the Hostname, port and the username I just set the name of the connection. In the beginning it was showing down in the action output that Could not connect.Server may not be run and in the msg part it was written Can't connect to MySQL server on '127.0.0.1' (10061)
but I thought I would be able to do a DB and test it Then I created simple DB and when I wanted to execute it I couldn't press the Bolt which execute the DB so I tried from Query and I pressed the 2nd option which is "Execute(All or Selection) to text" as I couldn't choose any other option and this error was shown Can't connect to MySQL server on '127.0.0.1' (10061) (2003)
我已经在我的 Windows 7 x64 上下载了MySQL Workbench 6.1,现在我想开始并做一个简单的数据库,我设置了一个新的 MySQL 连接,让它作为默认的主机名、端口和用户名,我只是设置了连接的名称。一开始,它显示在无法连接的操作输出中。服务器可能无法运行,并且在 msg 部分中它被写入,Can't connect to MySQL server on '127.0.0.1' (10061)
但我认为我可以做一个数据库并测试它然后我创建了简单的数据库,当我想执行它我无法按下执行数据库的 Bolt 所以我尝试从 Query 并按下第二个选项,即“执行(全部或选择)到文本”,因为我无法选择任何其他选项,这显示错误Can't connect to MySQL server on '127.0.0.1' (10061) (2003)
I am new in this I have used SQL*Plus for a while but it is not the same.
我是新手,我已经使用 SQL*Plus 一段时间了,但情况不一样。
Thanks in advance.
提前致谢。
采纳答案by Jens
Looks like the mysql server is not started.
看起来mysql服务器没有启动。
Look to the official documentationof MySQL how you can start a service under windows.
查看MySQL的官方文档如何在 windows 下启动服务。
Install the server as a service using this command: C:> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --install
使用以下命令将服务器安装为服务:C:> "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld" --install
回答by Techno Buzz
If you have already installed MySQL on a windows machine make sure it is running as a service.. You can do that by
如果您已经在 Windows 机器上安装了 MySQL,请确保它作为服务运行。您可以通过
Start --> services --> MySQL(ver) --> Right-Click --> Start
开始 --> 服务 --> MySQL(ver) --> 右键单击 --> 开始
回答by Gabriel
I was facing the same problem, but what I did not realise is that I did not have the MySQL Server installed. You must simply install the MySQL Server.
我遇到了同样的问题,但我没有意识到我没有安装 MySQL 服务器。您必须简单地安装 MySQL 服务器。
In order to install the MySQL server, you must run the "MySql Installer" and then press the "Add" button and then choose the "MySQL Server" in the tree.
为了安装 MySQL 服务器,您必须运行“MySql 安装程序”,然后按“添加”按钮,然后在树中选择“MySQL 服务器”。
After doing that, run you workbench again and you'll notice that there'll already be a connection configured. Hopefully you'll be able to create a new connection or as many connections as you want.
这样做之后,再次运行您的工作台,您会注意到已经配置了一个连接。希望您能够创建一个新连接或任意数量的连接。
Best regards!
此致!
回答by Broper
(Windows)If you have already installed MySQL server
(Windows)如果您已经安装了 MySQL 服务器
cd C:\Program Files\MySQL\MySQL Server X.X\bin
mysqld --install
cd C:\Program Files\MySQL\MySQL Server X.X\bin
mysqld --install
and still cannot connect, then the service did not start automatically. Just try
还是连接不上,说明服务没有自动启动。你试一试
Start > Search "services"
开始 > 搜索“服务”
and scroll down until you see "MySQLXX", where the XX represents the MySQL Server version. If the Status isn't "Started", then
并向下滚动,直到看到“MySQLXX”,其中 XX 代表 MySQL 服务器版本。如果状态不是“已开始”,则
Right Click > Start
右键单击 > 开始
回答by Deepak
In Windows goto task-manager >"services" and check that "MySQL" is runing. If not
Right click on it ->open services->MySQL-> startup type -> 'Automatic' -> apply and OK. this is for windows 10 MySql 5.7
在 Windows 中转到任务管理器>“服务”并检查“MySQL”是否正在运行。如果不是
右键单击它-> 打开服务-> MySQL-> 启动类型-> '自动' -> 应用并确定。这适用于 Windows 10 MySql 5.7
回答by Vitorino
I solved the problem as follows:
我解决了这个问题如下:
run MySQLInstanceConfig.exe
C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\MySQLInstanceConfig.exe
Follow to the end without changing anything.
运行 MySQLInstanceConfig.exe
C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\MySQLInstanceConfig.exe
坚持到底,不做任何改变。
回答by konyak
Avoid using bind_address
in your my.cnf file, if you have any.
避免bind_address
在 my.cnf 文件中使用(如果有)。
Ref: http://dev.mysql.com/doc/refman/5.5/en/can-not-connect-to-server.html
参考:http: //dev.mysql.com/doc/refman/5.5/en/can-not-connect-to-server.html
回答by Hamid Hoseini
回答by Reuben The Coder
Resolved this issue by navigating to C:\xampp\mysql\bin and double clicking on mysqld.exe and then allow access in the pop up that comes. My server status on workbench changed to running
通过导航到 C:\xampp\mysql\bin 并双击 mysqld.exe,然后在出现的弹出窗口中允许访问来解决此问题。我在工作台上的服务器状态更改为正在运行
回答by somdow
Just in case anyone needs this. For me in my case, I had installed a new installation of MYSQL(8) and WORKBENCH etc. so that I could then work on an old Wordpress website. No matter what I did, it wouldn't work. Kept getting "ERROR ESTABLISHING CONNECTION" etc. Thinking that it was maybe something to do with wordpress(since it is old), i tried a basic manual connection with php and nothing.
以防万一有人需要这个。就我而言,我已经安装了 MYSQL(8) 和 WORKBENCH 等的新安装,以便我可以在旧的 Wordpress 网站上工作。无论我做什么,它都行不通。不断收到“错误建立连接”等。认为这可能与wordpress有关(因为它很旧),我尝试了与php的基本手动连接,但什么也没有。
Eventually, I figured out that I had to downgrade MYSLQ. So i went back to MYSQL installer, found the server, and downgraded MYSQL from 8.0 back to 5.5
最终,我发现我必须降级 MYSLQ。所以我回到 MYSQL 安装程序,找到服务器,并将 MYSQL 从 8.0 降级回 5.5
As soon as I did that, everything worked. Hope this helps
一旦我这样做了,一切都奏效了。希望这可以帮助