如何设置 MAMP 以使用 OS X SL 上现有的 MySQL?

发布于 2024-10-03 16:41:40 字数 227 浏览 0 评论 0原文

我正在零配置环境中运行。我安装了 Ruby,然后安装了 MySQL 等。

现在,我使用 PHP,所以我安装了 MAMP PRO,发现它还包括 MySQL。

我认为我可以让 MAMP 使用与我在 OS X 上使用的相同的 MySQL。

我尝试将 MySQL 端口更改为默认的 3306,但它没有按预期工作。

如何让 MAMP 访问我现有的 MySQL?

I'm running on a zero-config environment. I installed Ruby, then MySQL, etc.

Now, I'm using PHP, so I installed MAMP PRO and see it also includes MySQL.

I thought that I could have MAMP use the same MySQL that I was already using on OS X.

I tried to change the MySQL port to the default 3306, but it didn't work as expected.

How can I let MAMP access the existing MySQL that I have?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等风来 2024-10-10 16:41:40

由于这是一篇旧文章,因此对 MAMP 版本之间的路径进行细微更改可能需要对此答案进行一些细微调整,尽管相同的过程适用于所有 MAMP/MAMP PRO 版本:

  • 单击“首选项”面板中的“端口”选项卡并设置 MySQL 端口更改为您现有的 MySQL 配置设置(在 OP 的情况下为 3306):

MAMP MySQL 端口更改

  • MAMP 将重新启动,您会注意到绿色状态灯没有亮起。打开 Finder 并导航到 MAMP 配置目录,如果您选择默认安装,该目录应类似于以下内容:

cd /Applications/MAMP/conf/php5

  • 打开 php5.ini在文本编辑器中打开 文件,找到以下行:

mysql.default_socket = /Applications/MAMP/tmp/mysql/mysql.sock

  • 将其更改为 MySQL 套接字的默认位置,即:

mysql.default_socket = /tmp/mysql.sock

  • 如果停止并启动 MAMP,您现在应该能够使用原始 MySQL 数据库。请注意,MAMP 现在将显示 MySQL 已停止,因为它实际上并不认为 MySQL 已启动:

MAMP status

这个答案很大程度上引用自 this网站

As this is an old post, slight changes to paths between MAMP versions may require some slight adjusting to this answer, though the same process will work in all MAMP/MAMP PRO versions:

  • Click the Ports tab in the Preferences panel and set your MySQL port to what your existing MySQL configuration is set to (3306 in the OP's case):

MAMP MySQL port change

  • MAMP will restart and you will notice the green status light isn't lit up. Open up your Finder and navigate to the MAMP configuration directory, which should be similar to the following if you chose the default installation:

cd /Applications/MAMP/conf/php5

  • open the php5.ini file in a text editor find the following line:

mysql.default_socket = /Applications/MAMP/tmp/mysql/mysql.sock

  • Change it to the default location of your MySQL socket, ie:

mysql.default_socket = /tmp/mysql.sock

  • If you stop and start MAMP, you should now be able to work with your original MySQL databases. Note that MAMP will now display that MySQL is stopped, because it really doesn't think MySQL is started:

MAMP status

This answer was largely referenced from this site.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文