Support Center

All About wp-config.php

Last Updated: Aug 19, 2015 03:51PM CDT

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: https://kb.asmallorange.com/customer/portal/articles/1603400.

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.

define('WP_HOME','http://www.yournewdomainname.com');
define('WP_SITEURL','http://www.yournewdomainname.com');

b2e1da5554fae60a8baf40cecd3cb9f6@asmallorange.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete