1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

change mysql port ? :(

Discussion in 'Database Discussions' started by setrow, Aug 18, 2010.

  1. setrow

    setrow New Member

    Joined:
    Dec 28, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hi,
    Cpanel Mysql use 3306 port and we want to change 6446 for mysql port

    What will we do ? We cant change 3306 port :(

    Thanks.
     
  2. Miraenda

    Miraenda Member

    Joined:
    Jul 28, 2004
    Messages:
    243
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Coralville, Iowa USA
    You can change the MySQL port in the /etc/my.cnf file:

    Code:
    port=6446
    Then restart MySQL:

    Code:
    /etc/init.d/mysql restart
    I did this change on my machine as a test and had no issue whatsoever changing it. Here's the results showing it began listening on that port after the change:

    Code:
    [root@itchy:~] # ps aux|grep mysql
    root 10660 0.3  0.1 6744 1076 pts/0 S 07:29 0:00 /bin/sh /usr/bin/mysqld_safe
    --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/hostname.com.pid
    
    mysql 10805 3.8 15.5 1510596 155372 pts/0 Sl 07:29 0:00 /usr/sbin/mysqld
    --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/hostname.com.pid 
    --skip-external-locking --port=6446
    Notice the --port=6446 part in the ps aux return?

    Code:
    [root@itchy:~] # lsof -i :6446
    COMMAND   PID  USER   FD   TYPE   DEVICE SIZE NODE NAME
    mysqld  10805 mysql   12u  IPv4 60642652       TCP *:6446 (LISTEN)
    Code:
    [root@itchy:~] # netstat -an|grep :6446
    tcp        0      0 0.0.0.0:6446          0.0.0.0:*             LISTEN
    As a final note, I did also check PhpMyAdmin and cPanel > MySQL Databases area. Both were working for me after this change, so this did not impact the various cPanel areas working on my server.
     
    #2 Miraenda, Aug 18, 2010
    Last edited: Aug 18, 2010
  3. prashant_ohol

    prashant_ohol Member

    Joined:
    Nov 22, 2004
    Messages:
    44
    Likes Received:
    0
    Trophy Points:
    6
    good one Miraenda,


    Prashant
     

Share This Page