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.
database file hosting passwords update user wp-admin wp-config