How do I change the database password for my WordPress site?

Changing the MySQL database password for your WordPress site is a good routine security measure, and it is essential after any suspected intrusion – if an attacker has had access to your site, they have almost certainly seen the database credentials stored in your wp-config.php file. Changing the password has two parts: updating it in the Loopia Customer Zone (kundzon), and then updating WordPress so it can still connect to the database with the new password. If you only do one of the two steps, your site will go offline with a database connection error, so it’s important to do both.

Step 1: Change the database password in the Customer Zone

Log in to the Loopia Customer Zone (kundzon) and change the password on the MySQL database that your WordPress site uses. The full procedure is described in our guide on changing passwords for Loopia services, under the heading Changing password for MySQL.

Make a note of the new password – you will need it in the next step.

Step 2: Update the password in wp-config.php

WordPress stores the database credentials in wp-config.php, in the root of your WordPress installation (usually public_html). To update them:

  1. Connect to your hosting via FTP. See how to connect via FTP if you need a refresher.
  2. Download wp-config.php from public_html to your computer.
  3. Open the file in a plain text editor (such as Notepad++, VS Code or Sublime Text – not Word).
  4. Find the line:
    define(‘DB_PASSWORD’, ‘your-old-password’);
  5. Replace the old password between the quotation marks with the new password you set in Step 1. Keep the quotation marks.
  6. Save the file and upload it back to public_html, overwriting the original.

Reload your site in the browser. If the password matches, your site will load as normal. If you see an “Error establishing a database connection” message, double-check that the password in wp-config.php exactly matches the one you set in the Customer Zone – a single stray character is enough to break the connection.

Was this article helpful?

Related Articles