Loading...

Knowledge Base

How To Reset MySQL Database User & Password

One of the most popular database management systems is MySQL. It's known for its reliability, scalability, and ease of use. However, to get the most out of MySQL, it's essential to set up a password, create a new database user, assign the user to a specific database, and update the connection string.

This article will guide you through the step-by-step process of doing just that. We will cover the naming conventions required for a successful connection and provide tips and tricks to make the process seamless. Whether you're a seasoned developer or starting with MySQL, this article will help you set up your database connection like a pro. 



The main MySQL username is primarily used to log in to phpMyAdmin. However, it can also be used in database connection scripts. If you use the main MySQL username to connect to a database, you must change the MySQL user password and update your script's password.

Note: MySQL users you create will not be affected. This password change is only for the main username, as shown on the password change screen.

How to Reset a MySQL Database User Password

  1. Log in to your Bluehost Account Manager.
  2. Click the Hosting tab from the side navigation menu to the left.
    Bluehost Dashboard highlighting 'Hosting' tab
  3. Scroll down to click the CPANEL button under Quick Links.
    Bluehost Dashboard highlighting 'CPANEL' button under Quick Links
  4. Click the MySQL Databases, found under the Databases section of the cPanel.
    MySQL under Databases
  5. Scroll down at the bottom and look for the Current Users section.
  6. Look for the MySQL User you want to update and click the Change Password next to it.
    cPanel-MySQL-change-password
  7. Enter the new password in the Password text box. The Password Strength Meter on the page will identify the password's strength.

    Note: You can generate a password by clicking the Password Generator button.

  8. Click the Change Password button when finished.
    bh-am-mysql-change-password

If you forgot the password to your MySQL database user, you must create a new user with a new password and then assign that user to the database. Don't worry, this won't erase or change any of the data in your database.

How to Create a New User

  1. Log in to your Bluehost Account Manager.
  2. Click the Hosting tab from the side navigation menu to the left.
  3. Scroll down to click the CPANEL button under Quick Links.
  4. Click the MySQL Databases icon under the Databases category.
  5. Locate the MySQL Users section of the MySQL Databases tool. To quickly find this section, click Jump to MySQL Users.
  6. Under Add New User, enter a username.

    Note: The username must be 7 letters or shorter.

  7. Enter a password in the Password field.
  8. Retype the password in the Password (Again) field.
  9. Click Create User.
    MySQL-add-new-user

How to 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 to which you need the password reset.
  3. Click Add.
    MySQL-assign-user
  4. Select the privileges you wish to grant the user from the MySQL Account Maintenance screen or select ALL PRIVILEGES.
  5. Click Make Changes.
    MySQL-privileges

You may remove the old user from the database by clicking the red X next to the user in the Current Databases table.

How to Re-configure Your Code

Now that you have a new user and password for your database, you must update your configuration file. Update the file to reflect the new database username and password, and your site should now be working as before.

Instead of resetting your password, you can find the existing password in your configuration file. If you need to find out where your configuration file is, check this list of different scripts to find its location: Location of Script Configuration Files.

Summary

To know how to reset a MySQL database password and configure a MySQL database connection is crucial for any web developer. By following the steps mentioned in this article, you can easily reset the MySQL database user password, create a new database user, assign the user to a specific database, and update the connection string to successfully connect to your MySQL database. Remember to follow the naming conventions and remember the things mentioned in the article. With these guidelines, you can manage your MySQL database like a pro.

If you need further assistance, feel free to contact us via Chat or Phone:

  • Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
  • Phone Support -
    • US: 888-401-4678
    • International: +1 801-765-9400

You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.

Did you find this article helpful?

 
* Your feedback is too short

Loading...