开发者

How to set MAMP to use existing MySQL on OS X SL?

I'm running on a zero-config environment. I installed Ruby, the开发者_高级运维n 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?


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):

How to set MAMP to use existing MySQL on OS X SL?

  • 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:

How to set MAMP to use existing MySQL on OS X SL?

This answer was largely referenced from this site.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜