Knowledgebase: WordPress
All About wp-config.php
Posted by ASO Admin on 30 January 2020 01:08 PM

The wp-config.php is a fundamental part of your WordPress installation.  It specifies, most importantly, information about how to connect to your WordPress database, which is where most of your content is stored. Without this file, your WordPress installation is a sad, empty shell.

Let's take a look at a the most important parts. You can use an FTP client or the cPanel File Manager to view your wp-config.php file. If you do you'll see the following section pretty close to the top:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'username_wp1');

/** MySQL database username */
define('DB_USER', 'username_admin');

/** MySQL database password */
define('DB_PASSWORD', 'a1S@d3f$');

/** MySQL hostname */
define('DB_HOST', 'localhost');


The above section is where WordPress specifies the MySQL database, the MySQL username and the MySQL user password (which is different than your cPanel username and your wp-admin username).  When someone clicks to one of your WordPress articles WordPress pulls the images from your media folder, which is usually in your wp-content folder. But it pulls all the text and metadata for your article from the database, using the info specified here in the wp-config.php file.

Note: if your WordPress gives you a database connection error, that often means that the data mentioned above is not correct.

On a cPanel system, you can create the database, user, and password without having to ever log in to the command line. Check out our instructions for this quick and easy process:

If you use Softaculous, then you specify the name of the MySQL database when you install, but it actually creates the database for you and assigns a user and password to it automatically! Done and done.

Tip! You can also use the wp-config.php file to correct a half-changed site URL! If you want to use a new domain name for your site, and make the change in WHM/cPanel before you make the change in the wp-admin area, your site may not work anymore. And you won't even be able to log in to the admin area to fix it, because that area relies on the domain name too. Whoops. If you have access to the wp-config.php file, however, you can simply add these following lines at the bottom, using your new domain name, and the site will work again.


(1 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
Full Name:
Help Desk Software by Kayako fusion
ERROR: This domain name (, does not match the domain name in the license key file

For assistance with your license, please contact the Kayako support team: