Skip to main content

How to Change Website and Database Credentials After a Compromise

After a security breach, changing your website and database credentials is a critical step to lock out unauthorized users and secure your data. This procedure allows a customer to update the credentials used by their website to connect to the...

After a security breach, changing your website and database credentials is a critical step to lock out unauthorized users and secure your data. This procedure allows a customer to update the credentials used by their website to connect to the database, ensuring that only authorized applications can access the information.

Warning: Changing database credentials will immediately break the connection between your website and your database. You must update your website's configuration files with the new credentials immediately after changing them to restore site functionality.

Before you begin

You will need:

  • Access to your website's files (via FTP, SFTP, or a File Manager)

  • Access to your hosting control panel (e.g., cPanel or Windows Control Panel)

  • The specific configuration file for your website's platform (e.g., wp-config.php for WordPress)

Update the database credentials in your control panel

  1. Log in to your hosting control panel.

  2. Navigate to the Databases section (e.g., MySQL® Databases in cPanel or MySQL Databases in Windows Control Panel).

  3. Locate the database used by your website.

  4. Select the specific database user associated with that database.

  5. Update the password for that user.

  6. Note the new password and the exact username.

Update the website configuration file

  1. Access your website's files using an FTP client or your hosting control panel's File Manager.

  2. Navigate to the root directory of your website.

  3. Locate the configuration file for your platform (e.g., wp-config.php for WordPress or configuration.php for Joomla).

  4. Open the file and locate the section containing the database connection details.

  5. Replace the old database password with your new password.

  6. Save the changes to the file.

Confirm the result

  • Your website should load successfully using the new credentials.

  • You can verify the connection by logging into your website's administrative dashboard.

If the website shows a "Database Connection Error"

If your site displays a "Database Connection Error" after you update the credentials, it means the information in your configuration file does not match the credentials in your control panel.

  1. Verify that the database name, username, and password in your configuration file are identical to the values in your control panel.

  2. Ensure there are no extra spaces or special characters in the configuration file that might interfere with the connection.

  3. If the issue persists, contact Hostek support with the specific error message and the name of the database you are using.

Limitations

This procedure only updates the credentials used by the website to communicate with the database. It does not change your hosting account password, your email account passwords, or the passwords for other services. If you suspect a compromise, you should also change your primary account passwords and any other credentials that may have been exposed.

Did this answer your question?