The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Changing root username in MySQL

Discussion in 'Database Discussions' started by fujipadam, Oct 19, 2010.

  1. fujipadam

    fujipadam Member

    Joined:
    Jun 25, 2009
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    Hi all,

    I would like to change the "root" username in MySQL since most people recommend that from a security pers.

    I ran the following:

    UPDATE user set user = <newrootname> where user = 'root';
    flush privileges;

    And that seems to work from a db stand-point. (The new username has all the privileges as the old root AFAIK.

    But I think there is something that needs to be done from cpanel. Because after I changed the root username, mysql restarts every five minutes. And phpMyadmin won't login from whm - gives an error about wrong username and password.

    Could you please let me know if something more needs to be done. OR if there is a better way to change the root username.

    Thanks in advance.
     
    #1 fujipadam, Oct 19, 2010
    Last edited: Oct 19, 2010
  2. fujipadam

    fujipadam Member

    Joined:
    Jun 25, 2009
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    The restarting of mysql is now okay. Apparently, what needs to be done is edit the following file as well:

    /root/.my.cnf

    That resolved that.

    The phpMyAdmin, however still has problem logging me in from cpanel.
     
  3. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I do see a mention of the root user in /usr/local/cpanel/base/3rdparty/phpMyAdmin/main.php file for this line:

    Code:
    && $cfg['Server']['user'] == 'root'
    I cannot be sure changing this will work to get it functioning, though, since we don't normally recommend changing the root MySQL user in cPanel's setup. I have to mention that if this doesn't work and you have issues, it's unsupported.

    If it does work, then you will want to put this file into the exclude list, since cPanel may overwrite the changes on updates otherwise:

    Code:
    echo "/usr/local/cpanel/base/3rdparty/phpMyAdmin/main.php" >> /etc/cpanelsync.exclude
     
Loading...

Share This Page