Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Set a New Password for a Database User

Lost the password of your database user? This guide shows how to set a new one and update your website.

Databases2 min read14 steps5 screenshots

What is a database user?

A database stores your website's data. A database user is like a key holder. It is a name and password that let your website open the database. You cannot read an old password back. You can only set a new one.

Warning: After you change the password, your website will stop working until you put the new password in its settings file. Do both steps in a row.

Steps in cPanel

  1. Log in to your hosting control panel (cPanel).
    Log into your cPanel account
  2. Open MySQL Databases.
    locate-the-databases-section
  3. Scroll down to Current Users.
    current-users
  4. Find your user. Click Change Password next to it.
  5. Type a new password twice. Or click Password Generator for a strong one.
    set-database-user-password
  6. Copy the password and keep it in a safe place.
  7. Click Change Password to save.
Tip: A strong password is long and mixed. It uses letters, numbers and symbols. Avoid words someone could guess.

Update your website

Your website keeps the database password in a configuration file. This is a small file of settings.

  1. Open File Manager in your control panel.
  2. Go to the folder of your website. This is often public_html.
  3. Find the settings file for your software. Here are some common names.
SoftwareFileSetting
WordPresswp-config.phpDB_PASSWORD
Joomlaconfiguration.php$password
Laravel.envDB_PASSWORD
  1. Right-click the file and choose Edit.
  2. Replace the old password with the new one. Keep the quote marks.
  3. Click Save Changes.
  4. Open your website to check that it loads.

If you see "Error establishing a database connection"

The password in the file probably does not match. Check for typos or extra spaces. If you use special symbols, make sure you copied them exactly.

If you still need help, open a support ticket.

Quick recap

  • Old database passwords cannot be shown. Set a new one.
  • In cPanel, use MySQL Databases and then Change Password.
    successfully-changed-your-password
  • Update the same password in your website's config file.
  • Use a strong password and store it safely.