How to fix the issues MySQL passwords do not work after upgrade

July 3, 2023 / MySQL

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

To know the version of MySQL

If you want to know which version of MySQL is installed on your server, but are unsure, then follow these steps.

  1. Log into “cPanel Account”.
  2. On the right sidebar of  the cPanel home page, click Server Information in the General Information.
  3. Under Server Information, you need to locate the MySQL Version row to determine the MySQL version installed on the server.

Problem


When you are trying to access a database on your server running MySQL 5.6.5 or later the login fails, after that, you are also using the correct username and password.

For Example: If you are running WordPress on your site, you  may see the following error message: Error establishing a database connection
Sometimes other web applications may display similar messages about database connection errors.

Cause


This problem happens when MySQL 5.6.5 and later versions use a new hashing method for user passwords. The newer MySQL versions don’t support the hash method that was used in older versions of MySQL to store passwords, so logins fail.

Resolution


To solve this problem, you have to delete and need to recreate the database user. Once you do this, MySQL will use the new hash method to store the password and the database user can log in again.

 

Follow these steps to fix the issues MySQL passwords do not work after upgrade

  1. Login to “cPanel Account”.
    Login to cPanel
  2. Search the “Database” section, and click on the “MySQL®Databases”
    MySQL Database
  3. Select the “Database” which you want to remove and click in the “Delete” Button.
    Current Database
  4. Now, click on “Delete User” to confirm the deletion, and then click on “Go Back”.
    Delete Database
  5. Add New User, and type the username of the user you deleted in step 3.
  6. Type the user “Password”.
  7. Retype the user “Password”.
  8. Click on “Create User”.Add new user

     

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

Dominos Search