Lost Database Password

Website software such as WordPress and Drupal, or database management software such as Workbench require a database user and the password for that user to access your database. If you have forgotten the password for your database user, you can set a new password from inside of cPanel.

Note: As an alternative to resetting the MySQL password, you may be able to find the existing password in your site's configuration file. If you are unsure where to locate the configuration file, please refer to our list of different scripts to find its location in the following article:

Setting a New Password for your MySQL User

To set a new password for a MySQL database user:

  1. Log into cPanel and click MySQL Databases in the Databases section:

  2. In the Current Users section, click Set Password next to the desired database user:



    Note: If you are making changes to a website and do not know which user to edit, you may view the user the site is connecting with in its configuration file:
  3. Enter a new password, re-enter the password, then click the Change Password button:



    Note: You may use the generate password button to randomly generate a secure password.

Re-Configuring Your Code

If you needed to reset the password to fix a website installation, the site's configuration file needs to be updated. Once the configuration file has been updated to reflect the new password, the site should work as it was prior.

If you are unsure of where your configuration file is, the following article will help you locate the file you need to edit the database password within:


cPanelcPanel is a popular web hosting control panel that helps you manage your hosting account and assists you in creating web sites, managing e-mail addresses, & installing applications to a server.

cPanel is available on all HostGator Linux hosting plans, including Shared Hosting, Reseller Hosting, VPS and Linux Dedicated Servers.