Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

DNSOnly mysql password

Discussion in 'Bind/DNS/Nameserver' started by rahnev, Mar 15, 2018.

Tags:
  1. rahnev

    rahnev Active Member

    Joined:
    Jul 6, 2016
    Messages:
    39
    Likes Received:
    3
    Trophy Points:
    8
    Location:
    Bulgaria
    cPanel Access Level:
    Root Administrator
    Is there any way to view the current MySQL password on cPanel DNSOnly installation? I can login to it using mysql command but want to view the current one. There is no way to change it via Web UI.
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    The MySQL root password is stored in the /root/.my.cnf file by default.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. rahnev

    rahnev Active Member

    Joined:
    Jul 6, 2016
    Messages:
    39
    Likes Received:
    3
    Trophy Points:
    8
    Location:
    Bulgaria
    cPanel Access Level:
    Root Administrator
    On cPanel installation - yes, but on cPanel DNSOnly - there is no such file.
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Is it possible it exists at another location? You can try finding it with a command such as:

    Code:
    find / -name ".my.cnf"
    If it doesn't exist, you can manually create this file in the /root directory with root ownership and 0600 permissions. Then, ensure the contents look like this:

    Code:
    [client]
    password=MySQLRootPasswordHere
    user=root
    Once this file is setup, you can follow the instructions to reset the MySQL root password from the top answer on a third-party URL like this:

    Change mysql root password on Centos7

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. ronaldst

    ronaldst Well-Known Member

    Joined:
    Feb 22, 2016
    Messages:
    61
    Likes Received:
    8
    Trophy Points:
    8
    Location:
    Norway
    cPanel Access Level:
    Root Administrator
  6. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,803
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @ronaldst,

    Could you open a support ticket using the link in my signature so we can take a closer look?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. ronaldst

    ronaldst Well-Known Member

    Joined:
    Feb 22, 2016
    Messages:
    61
    Likes Received:
    8
    Trophy Points:
    8
    Location:
    Norway
    cPanel Access Level:
    Root Administrator
    I found another source of information and this lead me to a working solution.

    The easiest way to do this:

    1. edit /etc/my.cnf, add the following
    Code:
    [mysqld]
    skip-grant-tables
    2. restart mysql
    Code:
    service mysql restart
    3. Run the following
    Code:
    mysql -u root
    use mysql
    UPDATE mysql.user SET Password=PASSWORD('YourPassword') WHERE USER='root' AND Host='localhost';
    FLUSH PRIVILEGES;
    quit
    4. edit /etc/my.cnf and remove the variable added in step 1 (skip-grant-tables)

    5. restart mysql
    Code:
    service mysql restart
    6. test login with new password
    Code:
    mysql -u root -h localhost -p
    Password
    7. Create a /root/.my.cnf
    Code:
    [client]
    password=YourPassword
    user=root
    8. Change file permissions of .my.cnf
    Code:
    chmod 0600 .my.cnf
    8. Test .my.cnf by logging into MySQL again
    Code:
    mysql -u root

    This worked for me running MySQL 5.6. on cPanel DNSOnly server.
     
    #7 ronaldst, May 18, 2018
    Last edited: May 18, 2018
    cPanelMichael likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice