Answered by the Webhosting Experts

Resetting MySQL User Password

MySQL is a popular open-source database management system that can store and manipulate data. To access a MySQL database, you need to create a user account and assign it a password. The process of creating a new user and database is also being done automatically upon a creation of cPanel account and when adding domains to said account. Resetting the MySQL user password can be very simple and can be performed using two methods as listed below in this Resetting MySQL User Password guide.

Changing MySQL User Password Using WHM/cPanel

This is the recommended method when performing a MySQL user password change when your server contains a cPanel installation.

  1. Login to your WHM/cPanel and search for “Change MySQL® User Password“.

    MySQL User Password Change Form
    MySQL User Password Change Form
  2. Select the MySQL user you wish to change the password.
  3. Ensure to type a password with a strength score of at least 80%, as shown below and press the “Change Password” once completed.
MySQL User Password Change Form Completion
MySQL User Password Change Form Completion

Changing MySQL User Password Using the Command Line Interface 

The following steps will describe the process involved in changing the MySQL user password via the command line once you’ve logged into your server via SSH or by using the Console feature in the customer portal.

  1. Login to the server as the “root” user.
  2. Type the command mysql -u root -h localhost -p to login to MySQL as the “root” user.
  3. Enter the “root” user MySQL password to login.
    1. If you are unsure of what the “root” user password is, you can use the command my_print_defaults -s client to view it in the main command prompt.
  4. Now that you are logged in to MySQL as “root” user.

    MySQL Login Prompt in Command Line
    MySQL Login Prompt in Command Line
  5. Run command SELECT user FROM mysql.user; to view a full list of available users.

    Full MySQL Users List via the Command Line
    Full MySQL Users List via the Command Line
  6. Use the following command to alter the password ALTER USER ‘pascalsuissa’@’localhost’ IDENTIFIED BY ‘MyNewPasswordis1234!’;
    1. “pascalsuissa” is the username.
    2. “MyNewPasswordis1234” is the password.
  7. Once the command has completed running, the prompt will display a “Query OK” message, indicating that the password change is now complete.

    Completion Prompt Indicating a Successful MySQL User Password Change
    Completion Prompt Indicating a Successful MySQL User Password Change

Need More Personalized Help?

If you have any further issues, questions, or would like some assistance checking on this or anything else, please reach out to us from your my.hivelocity.net account and provide your server credentials within the encrypted field for the best possible security and support.

If you are unable to reach your my.hivelocity.net account or if you are on the go, please reach out from your valid my.hivelocity.net account email to us here at: support@hivelocity.net. We are also available to you through our phone and live chat system 24/7/365.