How to Change MySQL Root Password in WHM (Simple Guide)

How to Change the MySQL or MariaDB Root Password

Overview

This process allows you to update the root password for your server’s MySQL® or MariaDB® database engine.

Warning: Always use a strong and secure password. If someone gains access to this password, they can control and manipulate all databases on the server.

By default, the root password for MySQL or MariaDB is stored securely in the following file:

/root/.my.cnf

Do not edit this file manually. It is automatically updated when the root password is changed through the appropriate system interface.

Note: In older system versions (before version 118), this feature was labeled differently. You don’t need to remember the database root password unless you specifically need to log in as the root database user.

Set a New Password

To change the root password for MySQL or MariaDB, follow these steps:

  1. Enter your new password in both the password and confirmation fields.
  2. The system checks password strength using a score from 0 to 100:
    • 0 = Very weak
    • 100 = Very strong
  3. Some systems may require a minimum strength level. A green strength meter indicates your password meets or exceeds the required level.
  4. Click Password Generator to create a secure password automatically.
  5. Warning: Avoid using characters like *, ., or other special symbols. These can break compatibility with database tools like phpMyAdmin.
  6. If using the password generator, select the "Numbers" option under advanced settings for best compatibility.
  7. Once you're ready, click Change Password to complete the update.

Working with Remote MySQL or MariaDB Servers

If you're using a remote MySQL or MariaDB server, make sure to choose whether you're updating the root password for the local server or the remote one. By default, the system assumes the remote database is being updated.

Additional Notes for Remote Servers:

  • If the password was changed from the hosting system, the remote server’s /root/.my.cnf file must also be updated manually with the new password.
  • If the password was changed directly on the remote server, make sure to update the connection profile on the hosting system and reactivate the connection to avoid authentication issues.
case studies

See More Case Studies