how to change mysql port in Linux

by
Share this Article: Facebook1Google+0Twitter0LinkedIn0Reddit0Pinterest0StumbleUpon0Digg

Question:

How to change mysql port ?

Answer:

To change mysql port, open /etc/my.cnf file:



# vi /etc/my.cnf

Set new port 3563:

port=3563

make sure that port not used for other services. (/etc/services)

Restart mysqld

#service mysqld restart

check that port is listening

[root@test1 ~]# netstat  -nat

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:37442 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3563 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 132 10.33.17.143:22 10.33.17.112:4295 ESTABLISHED
tcp 0 0 :::23 :::* LISTEN
tcp 0 0 ::1:631 :::* LISTEN
tcp 0 0 ::1:6010 :::* LISTEN
tcp 0 0 :::5900 :::* LISTEN
tcp 0 0 :::5901 :::* LISTEN
tcp 0 0 :::111 :::* LISTEN
tcp 0 0 :::6000 :::* LISTEN
tcp 0 0 :::4242 :::* LISTEN
tcp 0 0 ::ffff:127.0.0.1:4243 :::* LISTEN
tcp 0 0 :::5555 :::* LISTEN
tcp 0 0 ::1:53 :::* LISTEN
tcp 0 0 :::22 :::* LISTEN
[root@test1 ~]#

Enjoy

For questions please refer to our Q/A forum at : http://ask.unixmen.com/

Share this Article: Facebook1Google+0Twitter0LinkedIn0Reddit0Pinterest0StumbleUpon0Digg