无法在 MySQL Workbench 中连接到 127.0.0.1 处的 MySQL。系统错误 61

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

Failed to connect to MySQL at 127.0.0.1 in MySQL Workbench. System error 61

mysqldatabaseconnectionmampmysql-workbench

提问by ferguior

I'm running into a little trouble with MySQL Workbench. This is the situation, I'm developing a database to query it remotely from Android devices. This is the first time I use MySQL Workbench, so I've followed this tutorial:

我在使用 MySQL Workbench 时遇到了一些麻烦。这就是情况,我正在开发一个数据库来从 Android 设备远程查询它。这是我第一次使用 MySQL Workbench,所以我遵循了这个教程:

http://net.tutsplus.com/tutorials/databases/visual-database-creation-with-mysql-workbench/

http://net.tutsplus.com/tutorials/databases/visual-database-creation-with-mysql-workbench/

I have no problem creating the EER diagram and generating the SQL script. The problem comes when I try to connect to a MySQL server. I get this error:

我在创建 EER 图和生成 SQL 脚本时没有问题。当我尝试连接到 MySQL 服务器时出现问题。我收到此错误:

"Failed to Connect to MySQL at 127.0.0.1:3306 with user root. Lost connection to MySQL server at 'reading initial communication packet', system error: 61"

无法使用 root 用户在 127.0.0.1:3306 连接到 MySQL。在“读取初始通信数据包”时失去与 MySQL 服务器的连接,系统错误:61

http://img101.imageshack.us/i/capturadepantalla201104i.png/(if the link stops working tell me)

http://img101.imageshack.us/i/capturadepantalla201104i.png/(如果链接停止工作告诉我)

I've also tried using the Local Socket/Pipe connection method with the MAMP Socket in '/Applications/MAMP/tmp/mysql/mysql.sock', but it gives the same error. And I've also tried using MAMP port 8889 but still nothing.

我还尝试将本地套接字/管道连接方法与“/Applications/MAMP/tmp/mysql/mysql.sock”中的 MAMP 套接字一起使用,但它给出了相同的错误。我也试过使用 MAMP 端口 8889 但仍然没有。

So anyone knows how to fix it? And another question, can I connect from my Android device to my laptop(where the database is placed) without using MAMP? MySQL needs MAMP to serve queries? And the last thing, am I going into the right way? Or should I do it other way?

所以有人知道如何修复它吗?还有一个问题,我可以在不使用 MAMP 的情况下从我的 Android 设备连接到我的笔记本电脑(放置数据库的地方)吗?MySQL 需要 MAMP 来提供查询服务吗?最后一件事,我是否走对了路?还是我应该以其他方式做?

Thanks for reading.

谢谢阅读。

采纳答案by ferguior

You need to sure that Mysql process is running in your system. not sure in MAC but in windows it'called mysqld.exe

您需要确保 Mysql 进程正在您的系统中运行。在 MAC 中不确定,但在 Windows 中它称为 mysqld.exe

well take a look

好好看看

http://lists.mysql.com/mysql/124371

http://lists.mysql.com/mysql/124371

回答by Atari

I had the same issue, but part of your question is what fixed it for me:

我遇到了同样的问题,但您的部分问题是为我解决的问题:

  1. Set connection = Local Socket/Pipe

  2. Set socket path = "/Applications/MAMP/tmp/mysql/mysql.sock" (for me - I got the path from my MySQL log upon initialisation)

  1. 设置连接 = 本地套接字/管道

  2. 设置套接字路径 = "/Applications/MAMP/tmp/mysql/mysql.sock"(对我来说 - 我在初始化时从我的 MySQL 日志中获得了路径)

Running: MBP, OSX 10.8.3 (Mountain Lion), MAMP Pro

运行:MBP、OSX 10.8.3(Mountain Lion)、MAMP Pro

Can't really fathom any further what your issue may be, but perhaps double check your DB is properly initialised. But, perhaps this helps someone else :)

无法真正理解您的问题可能是什么,但也许仔细检查您的数据库是否已正确初始化。但是,也许这对其他人有帮助:)

回答by Paul Mosley

I typed: sudo /usr/local/mysql/support-files/mysql.server start into the terminal and it started the MySQL server successfully and I was able to connect to MYSQL workbench.

我输入: sudo /usr/local/mysql/support-files/mysql.server start 进入终端,它成功启动了 MySQL 服务器,我能够连接到 MYSQL 工作台。

回答by atoms

On osx 10.6 using mamp pro I solved this by allowing network accessin the MySQLtab from the home window. Hope it saves someone the pain too

在使用 mamp pro 的 osx 10.6 上,我在主窗口allowing network accessMySQL选项卡中解决了这个问题。希望它也能减轻某人的痛苦

回答by Amandeep Singh

Most commonly happens when database/serveris not running. You need to check your server, or restart it. You can do so if you have mysql workbench under server administration. Check your manual for restarting or starting the server.

最常发生在数据库/服务器未运行时。您需要检查您的服务器,或重新启动它。如果您在服务器管理下有 mysql 工作台,则可以这样做。检查您的手册以重新启动或启动服务器。

回答by Boyd Hemphill

When trying to use the MySQL Workbench and connect through an SSH tunnel, you will get this error when your SSH connection does not complete successfully (e.g. improper host, password, key file, etc)

尝试使用 MySQL Workbench 并通过 SSH 隧道连接时,如果 SSH 连接未成功完成(例如,主机、密码、密钥文件不正确等),您将收到此错误

A good way to trouble shoot this is to separately test the the ssh connection from the machine you are trying to connect from and establish that you can do so successfully.

解决此问题的一个好方法是从您尝试连接的机器上单独测试 ssh 连接,并确定您可以成功连接。

回答by Marshon

Try closing MySQL and running it as the admin. This worked for me.

尝试关闭 MySQL 并以管理员身份运行它。这对我有用。

回答by Nikhil G

After making above improvement such as checking if mysql serviceis running or not, you just need to give a small password while creating connection, it is ' 'or 1 time press on space-bar in case of GUI or workbench. After which you just need to validate your machine with server (validated HOST). For that purpose click on 'New Server Instance'and it will configure server/HOSTon your behalf itself.

做完以上检查是否mysql service正在运行等改进后,你只需要在创建连接时输入一个小密码,如果是' 'GUI或工作台,则是或按空格键1次。之后,您只需要使用服务器(已验证的主机)验证您的机器。为此,单击'New Server Instance'它将server/HOST代表您自己进行配置。

I have done this successfullyjust a few couple of minutes ago. My workbench software is able to show all pre-installeddatabases etc now.

几分钟前,我已经成功地完成了这项工作。我的工作台软件现在能够显示所有pre-installed数据库等。

Thanks!!!

谢谢!!!

回答by Daniel

I solved it! On a mac just go to spotlight search on the top right of the screen and type Mysql. Turn it on.

我解决了!在 Mac 上,只需转到屏幕右上角的聚光灯搜索并键入 Mysql。打开它。