In WordPress, the database credentials, including the database password, are typically stored in the wp-config.php
file. This file is located in the root directory of your WordPress installation. Here’s how you can change the database password in WordPress:
- Access the
wp-config.php
file:- Use an FTP client or access your hosting control panel to navigate to the root directory of your WordPress installation.
- Look for a file named
wp-config.php
and download it to your local machine.
- Open
wp-config.php
in a text editor:- You can use a simple text editor like Notepad (on Windows) or TextEdit (on Mac).
- Alternatively, you can use a code editor like Visual Studio Code or Sublime Text for a better experience.
- Locate the database connection settings:
- In
wp-config.php
, you’ll find a section that looks like the following:
- In
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'your_database_name');
/** MySQL database username */
define('DB_USER', 'your_database_user');
/** MySQL database password */
define('DB_PASSWORD', 'your_database_password');
/** MySQL hostname */
define('DB_HOST', 'localhost');
- Update the
DB_PASSWORD
field:- Change the value inside the single quotes for
DB_PASSWORD
to your new database password.
- Change the value inside the single quotes for
define('DB_PASSWORD', 'your_new_database_password');
- Save and upload the
wp-config.php
file:- Save the changes you made to the
wp-config.php
file. - If you downloaded the file, upload it back to the root directory of your WordPress installation, replacing the existing file.
- Save the changes you made to the
After making these changes, your WordPress site should be able to connect to the database using the new password. Make sure to keep a backup of the original wp-config.php
file before making any changes, just in case you need to revert to the previous configuration.
[…] How to change database credential in wordpress […]