Google Plus

how to change mysql port in Linux

Written by Mel Kham on . Posted in Frequently Asked Questions

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

Mel Kham

Founder of Unixmen, Living in Amsterdam. Am working in my free time to help people to understand the Opensource and to explain them in easy way how to make the fist steps to the the light. Working day and night with my Co-founder Zinovsky to keep this website live even with less resources.
  • amidevous

    service mysqld restart

    Stopping mysqld: [ OK ]

    MySQL Daemon failed to start.

    Starting mysqld: [FAILED]

    [root@ks392623 ~]# cat /etc/my.cnf

    [mysqld]

    datadir=/var/lib/mysql

    socket=/var/lib/mysql/mysql.sock

    user=mysql

    # Disabling symbolic-links is recommended to prevent assorted security risks

    symbolic-links=0

    [mysqld_safe]

    log-error=/var/log/mysqld.log

    pid-file=/var/run/mysqld/mysqld.pid

    système centos 6.3 please help

Like us on Facebook

This week Top Posts

Write for us

Recent Comments

SK

|

I am working on it. Stay tuned. Thanks for the comment.

adriana rizzati

|

You are right, I saw them just now and they are awesome!

SK

|

Thanks for the comment Abdullah. Stay tuned with us always.

Abdullah Musazai

|

Thank you for such a great service you always do, hope you gain more power and more energy to work more & more

Dominik Bauer

|

thx a lot!

 
IDG Tech Network
Copyright © 2008-2013 Unixmen.com .
Maintained by Anblik .