使用 XAMPP 连接到端口 3306 mysql workbench 的问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16581709/
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
problems connecting to port 3306 mysql workbench with XAMPP
提问by Andrew
I'm trying to learn the apache / mysql / php stack bundled with XAMPP. I can't connect to the MySQL server using the MySQL workbench:
我正在尝试学习与 XAMPP 捆绑在一起的 apache/mysql/php 堆栈。我无法使用 MySQL 工作台连接到 MySQL 服务器:
Your connection attempt failed for user 'root' from your host to server at localhost:3306: Can't connect to MySQL server on '127.0.0.1' (61)
您的用户“root”从主机到 localhost:3306 的服务器的连接尝试失败:无法连接到“127.0.0.1”上的 MySQL 服务器 (61)
Thinking it's a port problem, I check the port directly in Terminal with the command telnet 3306
:
认为这是端口问题,我直接在终端中使用以下命令检查端口telnet 3306
:
telnet: connect to address 127.0.0.1: Connection refused
telnet:连接到地址 127.0.0.1:连接被拒绝
Obviously the problem isn't with the Workbench, but something to do with the port connection itself.
显然问题不在于工作台,而与端口连接本身有关。
I'm using:
我正在使用:
- OS 10.8 Mountain Lion
- XAMPP 1.7.3
- MySQL workbench 5.2.47
- 操作系统 10.8 山狮
- XAMPP 1.7.3
- MySQL 工作台 5.2.47
回答by Andrew
Sorry all, I'm posting my own question and answer. I had this problem and it nearly destroyed me because I could not find the correct answer anywhere on the interwebz. I finally overcame it, and wanted to post my findings in case it helps another befuddled traveler.
对不起,我正在发布我自己的问题和答案。我遇到了这个问题,它几乎毁了我,因为我在interwebz上的任何地方都找不到正确的答案。我终于克服了它,并想发布我的发现,以防它帮助另一个迷糊的旅行者。
It turns out when you install XAMPP and choose to run the security routines, it automatically turns on a setting in the MySQL preferences to block connections on port 3306 from localhost. To fix this, open my.cnf in the xampp folder xamppfiles/etc. Look for the setting "skip-networking" which tells mySQL to block the port 3306. Comment this out by adding a pound sign so it is "#skip-networking". Now, the telnet command should work, and you should be able to use the Workbench.
事实证明,当您安装 XAMPP 并选择运行安全例程时,它会自动打开 MySQL 首选项中的设置,以阻止来自本地主机的端口 3306 上的连接。要解决此问题,请打开 xampp 文件夹 xamppfiles/etc 中的 my.cnf。查找告诉 mySQL 阻止端口 3306 的设置“skip-networking”。通过添加井号将其注释掉,使其成为“#skip-networking”。现在,telnet 命令应该可以工作了,您应该可以使用 Workbench。
Hope this is helpful for somebody!If it fixes your problem, give me a shout at @mrcheeks3185.
希望这对某人有帮助!如果它解决了您的问题,请在@mrcheeks3185 上喊我一声。
回答by Mohammad Esmail
I faced same problem but I solved it.
我遇到了同样的问题,但我解决了。
I changed the MySQL workbench port to 3307 in the file below
我在下面的文件中将 MySQL 工作台端口更改为 3307
C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
and keep the default port 3306 for XAMPP
并为 XAMPP 保留默认端口 3306
回答by CrsCaballero
I found that file after mount the image disk created for xampp, there you can find new_disc_mounted/etc/my.cnf
我在挂载为 xampp 创建的映像磁盘后找到该文件,您可以在那里找到 new_disc_mounted/etc/my.cnf
回答by Raphael Torres Balderas
for mac you should create only a user with password and grant access(in my case a I use root with password) and turn on ip address and use that address to connect with a client like navcat or workbench I use XAMPP 7.3
对于 mac,您应该只创建一个带密码的用户并授予访问权限(在我的情况下,我使用带密码的 root)并打开 ip 地址并使用该地址连接像 navcat 或工作台这样的客户端我使用 XAMPP 7.3
回答by Dawn Andario
If changing ports won't work. What I did, I just make sure both XAMPP and MySQL Workbench don't start the server at the same time. Just go to MySQL Workbench, Select Server > Startup/Shutdown > Shutdown.
如果更改端口不起作用。我所做的是确保 XAMPP 和 MySQL Workbench 不会同时启动服务器。只需转到 MySQL Workbench,选择 Server > Startup/Shutdown > Shutdown。
回答by S?awomir Piernikowski
If you do not have my.cnf
you can first go to xampp->mysql->bin->my.ini
, copy
the contents of the file, next create my.cnf
(in the bin
folder) and paste the content to the file you just created.
如果您没有,my.cnf
您可以先转到xampp->mysql->bin->my.ini
,复制文件的内容,然后创建my.cnf
(在bin
文件夹中)并将内容粘贴到您刚刚创建的文件中。
This works for me. I had the same problem. Now I can use both Xampp and Workbench on one PC. There is an issue: when you start workbench you get some warning that some features may not work properly since database is not fully compatible.
这对我有用。我有同样的问题。现在我可以在一台 PC 上同时使用 Xampp 和 Workbench。有一个问题:当您启动工作台时,您会收到一些警告,指出由于数据库不完全兼容,某些功能可能无法正常工作。