Home » WordPress » How to change WordPress database password

How to change WordPress database password

There may be situations when you need to change your WordPress website’s database password, or all database credentials. For example if you’re taking ownership of an existing WordPress site, or you’re moving website to a new server.

Changing WordPress database password is fairly simple process. You’ll need to edit one WordPress file. More tricky task would be to change database password in your hosting server if you need it. Today I’ll show you how to change WordPress password both in WordPress website, and in most popular hosting panels like DirectAdmin or cPanel.

Let’s begin with changing WordPress database password in your WordPress installation folder.

How to change WordPress database password

WordPress website’s database credentials are stored in wp-config.php file. It’s located in your hosting’s FTP server, in public_html or public directory, depending on server configuration.

Locating WordPress config file using FTP client

To get to that file you’ll need to login to your FTP server using FTP client like Filezilla, or you can locate the file using your hosting admin panel’s File manager.

Here’s where you’ll find it in Filezilla once you login to your hosting account:

where to find wordpress configuration file in ftp to change database credentials

In order to edit the file you’ll need to double click it to download it to your computer. Once you make necessary changes (we’ll get to in in a moment) you should drag and drop the updated file back to the same window, and replace the old wp-config.php file with an updated one.

Where to find wp-config.php file using FIle manager in DirectAdmin or cPanel

Best WordPress hosting 2023

To get to wp-config.php file in DirectAdmin you need to open File Manager, open public_html or public directory, and look for wp-config.php file.

CPanel‘s File manager looks slightly different but has basically the same structure.

how to edit wp-config.php file in directadmin

How to change WordPress database password in wp-config.php file

If you want to edit wp-config.php file in your computer you need to open it with any code editor or basic text editor (like Notepad). You’ll see basically the same thing as you’ll see in the example opened in DirectAdmin file editor.

Once you open the config file look for these lines:

  • define(‘DB_NAME’, “some_database_name“) – that’s your WordPress database name
  • define(‘DB_USER’, “some_database_username“) – that’s WordPress database username
  • define(‘DB_PASSWORD’, “some_password_here“) – that’s WordPress database password

To change database password you need is to enter new password instead of the old one between the commas.

how to update wordpress database password

Just don’t forget to save changes by clicking Save As in DirectAdmin, or saving and reuploading wp-config.php file using FTP client. And that’s it – your WordPress database password is updated.

The same way you can change WordPress database name and username.

How to change WordPress database password in DirectAdmin or cPanel or any other hosting panel

We learned how to change WordPress database credentials in wp-config.php file. But what if we don’t know the current database password in the first place? That’s not a big deal actually. Here’s an example how to change database password in DirectAdmin.

First step – open MySQL Management in DirectAdmin panel.

how to change wordpress database password in directadmin

Then click on the database name of your WordPress site.

how to change database password in directadmin

You won’t be able to see old database password in DirectAdmin or cPanel but you’ll be able to change it. Click modify password.

change database password in directadmin for wordpress website

Now you need to enter new password (or hit Random to generate a safe password automatically), and click Save.

new wordpress database password in directadmin panel

Job done – now you changed your database password. Just don’t forget to get back to the beginning of this article to update WordPress database password in wp-config.php file.

Learn more about DirectAdmin and WordPress

Today you learned how to update database password for WordPress website. But what if you want to add another WordPress website using DirectAdmin panel? You can check how to install WordPress using directadmin here.

Hostinger - best WordPress hosting 2023

ImakeITwork recommends Hostinger!

Hostinger provides reliable and affordable WordPress, shared and VPS hosting. Get additional 10% OFF by using code IMAKEITWORK in Checkout.
Get Hosting Now →

Fathom analytics - privacy focused cookie-free website analytics