Skip to main content

DNSOnly mysql password

Comments

6 comments

  • cPanelMichael
    Hello, The MySQL root password is stored in the /root/.my.cnf file by default. Thank you.
    0
  • rahnev
    Hello, The MySQL root password is stored in the /root/.my.cnf file by default. Thank you.

    On cPanel installation - yes, but on cPanel DNSOnly - there is no such file.
    0
  • cPanelMichael
    Hello, Is it possible it exists at another location? You can try finding it with a command such as: 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: [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.
    0
  • cPanelMichael
    Hello @ronaldst, Could you open a support ticket using the link in my signature so we can take a closer look? Thank you.
    0
  • ronaldst
    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 [mysqld] skip-grant-tables
    2. restart mysql service mysql restart
    3. Run the following 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 service mysql restart
    6. test login with new password mysql -u root -h localhost -p Password
    7. Create a /root/.my.cnf [client] password=YourPassword user=root
    8. Change file permissions of .my.cnf chmod 0600 .my.cnf
    8. Test .my.cnf by logging into MySQL again mysql -u root
    This worked for me running MySQL 5.6. on cPanel DNSOnly server.
    0

Please sign in to leave a comment.