Lost MySQL Database Password


In the event of forgetting or misplacing your MySQL Database user password you will need to create a new user with a new password. You will also need to assign the newly created user to your existing database. Don't worry though, this will not erase or change any of the data in your database.

Before proceeding with the above step, it is advisable to check your websites configuration file to see if you can retrieve the database password from there.

Click here to view a list of common locations for configuration files.

Create a New Database User

  1. Log into cPanel
  2. In the Databases section, click MySQL Databases.
  3. Locate the MySQL Users section of the MySQL Databases tool.
  4. Under the Add New User, enter a username ensuring it is 7 Characters or shorter.
  5. In the Password field, enter a strong password.
  6. Confirm the password by retyping it in the second password field.
  7. Click Create User. 

Assign New User to Database

  1. Under 'Add User to Database', select the newly created user from the User drop-down menu.
  2. From the Database drop-down menu, select the existing database for which you need the password reset.
  3. Click Add.
  4. From the MySQL Account Maintenance screen, select the privileges you wish to grant the user. You can use your existing user for the database as a guide on which privileges the new user requires.
  5. Click Make Changes.

Re-Configuring Your Code

Now that you have created a new user and password for your database, the site's configuration file needs to be updated. For help with locating your configuration file please click here to view a list of common locations for configuration files. Once the sites configuration file has been amended, the site should work as before.

Have more questions? Submit a request