Change port # for mysql on mac

后端 未结 6 811
甜味超标
甜味超标 2021-02-09 07:34

I just installed mysql on a mac running 10.6. The mysql version is 5.1.56. I need to have mysql run on port 3307. This article says we can change the port by modifying this file

相关标签:
6条回答
  • 2021-02-09 08:11

    Looks like the new installers are adding the port as 3307

    To change that follow below steps

    sudo vi /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
    change 3307 from this line <string>--port=3307</string> to 3306
    
    0 讨论(0)
  • 2021-02-09 08:12

    On OSX you can create /etc/my.cnf if it does not exist. You can base it on samples found in /usr/local/mysql/support-files. Don't forget to restart MySQL for your my.cnf to take effect.

    0 讨论(0)
  • 2021-02-09 08:12

    I tried a long time to get mysql running on my Mac (OSX 10.11.13) with mysql 5.7.11 to develop wordpress sites on my local machine...

    When I used the app duplicator to migrate a website to my local machine I got errors during the database import. This was caused by to stricked sql_mode...

    The trick that made it was:

    Going to

    /usr/local/mysql-5.7.11/support-files/ 
    

    and copy the content from my-default.cnf

    and paste it to

    /etc/my.cnf (if this file does not exist create it!)

    at the very last line of my.cnf I added:

    sql_mode="NO_ENGINE_SUBSTITUTION"
    

    Et voilà: sql_mode is changed permanently!

    Whoop whoop!

    0 讨论(0)
  • 2021-02-09 08:19

    By default, the install doesn't create a my.cnf file on Snow Leopard. You can create one yourself under /etc or you can copy one from /usr/local/mysql/support-files/

    Then run : sudo cp my-huge.cnf /etc/my.cnf

    Check out the explanation here

    0 讨论(0)
  • 2021-02-09 08:28

    On MacOs High Sierra running MySql v8 server, you need the following:

    1. Edit /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

    2. Under ProgramArguments, you will see many entries with <string>...</string> etc,

    3. Add the following line: <string>--port=16000</string>

    Also, to restart you need to do the following:

    launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
    

    and then

    launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
    

    I hope this helps.

    0 讨论(0)
  • 2021-02-09 08:29

    I installed docker and was having problems with my company wanting to use port 3306 (which is what I was using privately).

    Similar problem to you. So this is what I did to fix it.

    sudo vi /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

    Then you get a long list of script tags and

    Insert <string>--port=3307</string> into the array. Make sure you put it under the other strings and within the array.

    I changed my port to 3307 instead of 3306 and now docker is working.

    0 讨论(0)
提交回复
热议问题