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:
# vi /etc/my.cnf
http://www.cyberciti.biz/faq/change-default-mysql-port-under-linuxunix/
but there is no such file in /etc. I can see mysql is running ok because I can connect to it just fine, is the way we change the port # different now?
Thanks
If you do not want to use the default port numbers for the application servers, you can change them.
How to Change My Port Number 1 Find PortNumber 2 Click Edit > Modify, and then click Decimal. 3 Type the new port number, and then click OK. 4 Close the registry editor, and restart your computer. See More....
Start the registry editor. (Type regedit in the Search box.) Navigate to the following registry subkey: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber. Click Edit > Modify, and then click Decimal. Type the new port number, and then click OK.
The change port command maps a serial port to a different port number, allowing apps that don't support high-numbered COM ports to access the serial port. Remapping works only for the current session and is not retained if you log off from a session and then log on again.
However many legacy applications expect the port to be between 1-4. Let’s change that:Right click on the device and click on ‘Properties’. Click on ‘Port Settings’. Then click on ‘Advanced…’.
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
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.
On MacOs High Sierra running MySql v8 server, you need the following:
Edit /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
Under ProgramArguments
, you will see many entries with
<string>...</string>
etc,
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.
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
I experienced a similar problem and here's what worked for me. If you installed MySQL using brew install mysql
then this should work for you.
For context, I'm using macOS Monterey 12, Homebrew 3.4.5, and MySQL 8.0.
MySQL is installed in:
/opt/homebrew/Cellar/mysql/8.0.28_1/
The configuration file my.cnf
is located at /opt/homebrew/etc
.
You can change the default port by specifying a new port in the my.cnf
file.
First navigate to the homebrew etc folder
cd /opt/homebrew/etc
Append the new port value to the my.cnf
file
echo "port = 3307" >> my.cnf
restart the MySQL service
brew services restart mysql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With