To change the port, select the “my.cnf file.

Change it to whatever you like and remove the # from the front. Then restart the engine and you should be set for that.

Open /etc/my.cnf file:

# vi /etc/my.cnf

Set new port 5123:
port=5123
Here is is my sample /etc/my.cnf file:

    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    port=5123
    old_passwords=1
    bind = 203.171.31.11

document.currentScript.parentNode.insertBefore(s, document.currentScript);