How To Reset MySQL Database User & Password | Bluehost Support
Support
  1. bluehost knowledge base

How To Reset MySQL Database User & Password

This article will address how to set the main MySQL password, create a new database user, assign the new user to a specific MySQL database, and update the connection string to successfully connect to your MySQL database. It is important to know the naming convention created for your MySQL database and users to successfully connect to the MySQL database. This article will address the following:



Naming Convention

Since we run a shared hosting environment, we uniquely identify your MySQL users to your account ONLY. We do this by attaching your system's username and an underscore("_") before all the MySQL databases and MySQL users YOU create.

Example:

  • In creating a New Database, you enter "db01"
    The real database name: username_db01.
This applies to both your database name and database user. Your password stays normal or is not pre-pended, like the database name or user.

Things to keep in mind:

  • Your MySQL User can only be up to 7 characters long.
  • You also need to remember to add your MySQL User to your database after the two are created.

Database Server/Host Address:

If your script or program is going to be accessing our database locally, meaning script and database are on the same account. The server/host address will always be localhost, just like that, lowercase and one word.

If you are using Remote Database Connection Setup, the server would either be your domain name: example.com or the Shared Server IP (preferred choice). The shared server IP is found in the Stats section of the cPanel on the left side.

The main MySQL username is primarily used to login to phpMyAdmin; however, it can also be used in database connection scripts. If you are using the main MySQL username to connect to a database, you will need to 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.


Setting the main MySQL Password

Note: Legacy accounts will feature a horizontal navigation bar at the top of the screen, while Bluerock account users will see a vertical navigation menu on the left-hand side of the screen. If you are still unsure what interface your account uses, please see Bluerock vs. Legacy to determine which step to follow.

Bluerock

  1. Log in to your Bluehost control panel.
  2. Click the Advanced tab from the side navigation menu to the left.
    rock-bh-advanced-tab
  3. Click the MySQL Databases, found under the Databases section of the cPanel.
    rock-mysql
  4. Scroll down at the bottom and look for the Current Users section.

    Tip: You may also locate the MySQL Users section by clicking "Jump to MySQL Users."
    rock-jumpto-mysql-users

  5. Look for the MySQL user you would like to update and click the Change Password right next to it.
    rock-dbuser-changepw 
  6. Enter the new password in the "Password" text box. The "Password Strength Meter" on the page will identify the strength of the password.
    rock-dbuser-setwp

    Note: You have the option to generate a password by clicking the Password Generator button.

  7. Click the Change Password Button when finished.

Legacy

  1. Log in to your Bluehost control panel.
  2. Click the cPanel in the sub-menu that stretches across the top of your screen.
    legacy-cpanel-tab
  3. Click the Reset MySQL Password icon, found under the Databases section of the cPanel.
    legacy-reset-mysqlpw
  4. Notice the username shown. This is the main username for your account.
  5. Enter a new password in the "New Password" text box. As you type, you will see the password requirements which have not yet been met. You can also see your password's strength.

    Note: This will only change the password for the main MySQL user.

  6. Enter the same password again in the second "New Password" text box.
  7. Click the Set MySQL Password button. You should then see a message "Your password has successfully been updated; click here to continue."


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. Do not worry; this will not erase or change any of the data in your database.

Create a New User

  1. Log in to your Bluehost cPanel account.
  2. Click the Advanced tab from the side navigation menu to the left.
    rock-bh-advanced-tab
  3. Click the MySQL Databases icon under the Databases category.
    rock-mysql
  4. Locate the MySQL Users section of the MySQL Databases tool. To quickly find this section, click Jump to MySQL Users.
    rock-jumpto-mysql-users
  5. Under Add New User, enter a username.
    rock-mysql-addnew-user

    Note: The username must be 7 letters or shorter.

  6. Enter a password in the Password field.
  7. Retype the password in the Password (Again) field.
  8. Click Create User.


Assign New User to Database

  1. Under "Add User to Database," select the newly created user from the User drop-down menu.
    rock-mysql-assign-user
  2. From the Database drop-down menu, select the existing database to which you need the password reset.
  3. Click Add.
  4. From the MySQL Account Maintenance screen, select the privileges you wish to grant the user or select ALL PRIVILEGES.
    rock-mysql-privileges
  5. Click Make Changes.
    rock-privileges-success

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


Re-configuring your code

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

Instead of resetting your password, you may be able to find the existing password in your configuration file. If you are not sure where your configuration file is, check this list of different scripts to find its location: Location of Script Configuration Files.

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.