Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  MySQL  >  How to Resolve “MySQL passwords do not work after upgrade” Error?
Top Scroll

How to Resolve “MySQL passwords do not work after upgrade” Error?

 2 min

In this article, you will learn to resolve the problem that occurs after a server is upgraded to MySQL 5.6.5 or later.

In case you don’t know which MySQL version is installed on your server, follow these steps:

  1. Log in to cPanel.
  2. Go to the right sidebar of the cPanel home screen, under General Information, click Server Information.
  3. Under Server Information, locate the MySQL Version row to check the MySQL version installed on the server.

Problem

When accessing a database on the server running MySQL 5.6.5 or later, the login fails even if you have been using the correct username and password.

For instance, while running WordPress on your site, you see the below error message:

Error establishing a database connection

Also with other web applications, similar messages may get displayed about database connection errors.

Cause

The cause of this issue is the use of a new hashtag method for user passwords by MySQL 5.6.5. The further MySQL versions don’t support the hash method, used in older versions of MySQL to store passwords and so the logins fail.

Resolution

For resolving this issue, you should delete and recreate the database user. While doing this, the new hash method is used by MySQL to store the password, and the database user can log in again.

To do this, follow the below steps:

  1. Log in to your cPanel account.
  2. Go to the Databases section of the cPanel home screen and click on MySQL® Databases.
  3. Then locate the database user that you want to recreate under Current Users and click Delete.
  4. In order to confirm the deletion, click Delete User and then click on Go Back.
  5. Under Add New User, in the Username text box, type the username of the user you deleted just now.
  6. In the Password text box, type the user password.
    Note: There is no need to create a new password for the user. The previous password can be used, if you want to keep the password unchanged. For finding the current password, check your application’s configuration files. For example, for WordPress, you will need to check the wp-config.php file for database configuration information.
  7. Retype the user password in the Password (Again) text box.
    Note: As an alternative, you can click Password Generator and cPanel will generate a random, strong password for you.
  8. Now click on Create User. cPanel creates the database user with the new hashing method to store the password.

In this way, you can resolve the error “Error establishing a database connection”.

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.