Wesbytes Knowledge Base

Search our articles or browse by category below

MySQL passwords do not work after upgrade

Last modified: July 2, 2022
You are here:
Estimated reading time: 1 min

MySQL passwords do not work after upgrade

This article describes a problem that occurs after a server is upgraded to MySQL 5.6.5 or later, and how to resolve it.

PROBLEM

When you try to access a database on a server running MySQL 5.6.5 or later the login fails, even though you are using the correct username and password.

For example, if you are running WordPress on your site, you see the following error message:

Error establishing a database connection

Other web applications may display similar messages about database connection errors.

CAUSE

This problem occurs because MySQL 5.6.5 and later versions use a new hashing method for user passwords. These newer MySQL versions do not support the hash method that was used in older versions of MySQL to store passwords, so logins fail.

RESOLUTION

To resolve this problem, you must delete and recreate the database user. When you do this, MySQL uses the new hash method to store the password, and the database user can log in again.

To do this, follow these steps:

  1. Firstly, log in to cPanel.

  2. In the Databases section of the cPanel home screen, click MySQL Databases.

  3. Under Current Users, locate the database user that you want to recreate, and then click the Delete icon.

  4. Next, click Delete MySQL Users to confirm the deletion, and then click Go Back.

  5. Under Add a New User, in the Username text box, type the username of the user you deleted in step 3.

  6. After that, type the user password in the Password text box.

  7. In the Password (Again) text box, retype the user password.

  8. Lastly, click on Create a User. cPanel creates the database user using the new hashing method to store the password.
Was this article helpful?
Dislike 0
Views: 10