如何将 MySQL 工作台与 MAMP PRO 连接?

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

How to connect MySQL workbench with MAMP PRO?

mysqlmacosmamp

提问by Chris Hough

What is the fix to connect the MySQL Workbenchtool with the MAMP PROMySQL database?

MySQL Workbench工具与MAMP PROMySQL 数据库连接的修复方法是什么?

采纳答案by Chris Hough

I was able to get http://www.sequelpro.com/working by pointing it to the socket: /Applications/MAMP/tmp/mysql/mysql.sock

我能够通过将它指向套接字来使http://www.sequelpro.com/工作:/Applications/MAMP/tmp/mysql/mysql.sock

回答by Mike

Change the connection type from TCP/IPto Local, then point it to the socket:

将连接类型从 更改TCP/IPLocal,然后将其指向套接字:

/Applications/MAMP/tmp/mysql/mysql.sock

/Applications/MAMP/tmp/mysql/mysql.sock

Your username and pw will most likely be root / root

您的用户名和密码很可能是 root / root

回答by elboletaire

As Mikesaid you can use the Local option and point it to the socket:

正如迈克所说,您可以使用本地选项并将其指向套接字:

/Applications/MAMP/tmp/mysql/mysql.sock

Or you can generate a symbolic link to your mysql socket (from your terminal):

或者您可以生成一个指向您的 mysql 套接字的符号链接(从您的终端):

sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/

Doing it this way the changes will be permanentand you will be able to connect to mysql using the mysqlclior any other external tool.

这样做,更改将是永久性的,您将能够使用mysqlcli或任何其他外部工具连接到 mysql 。

回答by Jonathan

After looking around for quite some time, Mike's answer worked great.

环顾四周一段时间后,迈克的回答效果很好。

However, I also discovered that going into MySQL tab and checking Allow network access to MySQLand choosing the only from this Macradio button I was able to connect using the previously saved connection in MySQL Workbench that I had been using with standard MAMP before upgrading to MAMP Pro.

但是,我还发现进入 MySQL 选项卡并检查Allow network access to MySQL并选择only from this Mac单选按钮,我可以使用以前保存在 MySQL Workbench 中的连接进行连接,在升级到 MAMP Pro 之前,我一直在使用标准 MAMP。

MAMP Pro MySQL settings for allowing local network access

用于允许本地网络访问的 MAMP Pro MySQL 设置

So for those of you who are moving from MAMP to MAMP Pro and already have your connections setup in MySQL Workbench, this option is quicker than setting up a new connection using a unix socket.

因此,对于那些从 MAMP 迁移到 MAMP Pro 并且已经在 MySQL Workbench 中设置连接的人来说,此选项比使用 unix 套接字设置新连接更快。

回答by Dmitry Krychylskyy

CONNECTION TO DB with MAMP

使用 MAMP 连接到数据库

Connection to DB with MAMP. You must use local connection

使用 MAMP 连接到数据库。您必须使用本地连接

回答by brunoramonalmeida

In my case the problem was the ports. As well explained here, the default mysql port in MAMP is 8889, and not 3306, although in MAMP localhost website says that it`s running in 3306.

就我而言,问题是端口。正如这里所解释的,MAMP 中的默认 mysql 端口是 8889,而不是 3306,尽管在 MAMP localhost 网站上说它在 3306 中运行。

回答by J?rn

I had the same problem and fixed it by unchecking the "Allow local access only" checkbox in the Server->MySQL Tab

我遇到了同样的问题,并通过取消选中服务器-> MySQL 选项卡中的“仅允许本地访问”复选框来修复它

回答by here

Make sure MySQL is set to "on" in addition to Apache or nginx. The Serversbutton may not toggle all of them.

确保除 Apache 或 nginx 外,MySQL 设置为“on”。该Servers按钮可能无法全部切换。

In my case, only Apache was running :)

就我而言,只有 Apache 正在运行 :)

回答by Jonas Stensved

I'm only able to connect if I use the socket /Applications/MAMP/tmp/mysql/mysql.sockAND set "Run Apache/MySQL as user www/mysql" in the gerneral tab.

如果我使用套接字并在常规选项卡中/Applications/MAMP/tmp/mysql/mysql.sock设置“以用户身份运行 Apache/MySQL www/mysql”,我只能连接。

回答by Christopher Jones

If, after following Mike'sanswer you receive:

如果在遵循迈克的回答后您收到:

Operation failed: /usr/local/mysql/support-files/mysql.server start is invalid

Follow the instructions here. For me, I had to replace /usr/local/mysqlwith /Application/MAMP/Libraryin the fields:

按照此处的说明操作。对我来说,我必须在字段中用/Application/MAMP/Library替换/usr/local/mysql

  • Start MySQL:
  • Stop MySQL:
  • Check MySQL Status:
  • 启动 MySQL:
  • 停止 MySQL:
  • 检查 MySQL 状态: