Yogesh Chauhan's Blog

How to update database configurations in WordPress?

in WordPress on December 26, 2021

I briefly discussed about this in the previous wp-config.php basics post:

An Introduction to wp-config file in WordPress

Let’s recap that.

To update the database configurations you need to change the contents inside the wp-config.php file.

When you’re setting up your website on a new server, you need to change your database configurations. You should be able to get that from your server providers.

To change the database configurations, you need to have these information handy.

  • Database Name
  • Database Username
  • Database Password
  • Database Host
    • In some cases you might need a port number, Unix socket file path or pipe.

Set Database Name

Add this line of code in your wp-config.php file to set your WordPress MySQL database name.

Add your database name instead of DATABASE_NAME.


define( 'DB_NAME', 'DATABASE_NAME' ); 

Set Database User

Add this line of code in your wp-config.php file to set your username.

Add your database username instead of USERNAME.


define( 'DB_USER', 'USERNAME' );

Set Database Password

Add this line of code in your wp-config.php file to set your WordPress MySQL database password.

Add your MySQL database password instead of PASSWORD.


define( 'DB_PASSWORD', 'PASSWORD' );

Set Database Host

Most of the time, your hosting provider will ask you set it as a “localhost” but in many cases, there are different values associated with it. Better to ask them for this info.

Add this line of code in your wp-config.php file to set your WordPress MySQL database name.

Add your database host instead of DATABASE_HOST.


define( 'DB_HOST', 'DATABASE_HOST' );

Apart from that line of code, you might need to add a port number or Unix socket file path to setup a database host.


Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface #Jan 14 How to display a student’s individual transcript in Colleague? #Jan 11 How to install PuTTY on a MacOS?
You might also like these
Recursive WITH Queries in Postgres (Common Table Expressions)PostgresABS and NEG functions in Envision BasicEnvision BasicWhat is Prototypal Inheritance in JavaScript?JavaScriptWhat is Git?MiscellaneousHow to display and animate image on scroll using JavaScript?JavaScriptHow to insert Bootstrap 4 in Angular 9 app?Angular