How to change database credential in wordpress

Posted by

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:

  1. 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.
  2. 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.
  3. Locate the database connection settings:
    • In wp-config.php, you’ll find a section that looks like the following:
    // ** 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');
  1. Update the DB_PASSWORD field:
    • Change the value inside the single quotes for DB_PASSWORD to your new database password.
       define('DB_PASSWORD', 'your_new_database_password');
  1. 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.

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.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x