How to change default MySQL port in linux?

I have a sever and due to some reasons I want to run the MySQL server on the different port and not on the detault port 3306.

How to change the MySQL default port on my Linux box?

Thanks

View Answers

December 4, 2013 at 5:20 PM

Hi,

Here are the steps of change the MySQL's default port on Linux based computer.

Step 1:

Loin to your Linux computer as root.

Step 2:

Using vi editor tool open the my.cnf file for editing. Here is the command:

vi /etc/my.cnf

Find the entry:

port       = 3306

Step 3:

Change it to desired port

port       = 3307

or something else.

Save the file and exit the vi editor.

Step 4:

Restart the mysql server using following command:

service mysql restart

After restarting the MySQL server it will start listening on another port.

Thanks


December 4, 2013 at 5:21 PM

Hi,

Check the tutorial MySQL default port number and how to change it if you are using windows machine.

Thanks









Related Tutorials/Questions & Answers:
Advertisements