How to Code your wp-config.php file in WordPress

Whether you are new to WordPress or you’ve been using it for many years like me then you know that when you install WordPress you’ve always got to work with the wp-config file.  Just like it sounds the wp-config file is a PHP file that tells WordPress where and how to configure WordPress with your mySQL database.

Now this can be daunting for many people considering creating a WordPress website that they host on their own servers under their own domain name (The other less invasive way is to go to www.Wordpress.com and create a wordpress website this way but you won’t have control over the domain name or hosting because WordPress.com hosts it all!) considering that you need to know what and how to code this PHP file in PHP and deploy it to your website.  Now, for those of you who are brave enough to learn a little PHP please keep reading.

When you get down to editing the wp-config file you will need to be able to provide information about the mySQL database including the database name, the user name, the database password and mySQL hostname also known as the “localhost” by some web hosting companies.  The next thing you will need to edit the “wp-config-sample.php” you’ll need to save it as “wp-config.php” for it to work correctly.  Below are some of the fields you will encounter in the wp-config.php file…

// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘putyourdbnamehere’);

/** MySQL database username */
define(‘DB_USER’, ‘usernamehere’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘yourpasswordhere’);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

In order to locate the values for these fields you’ll need to access your web hosting account and either create a mySQL database or access an existing mySQL database in order to get this information.  Once you have this information simply add it to your wp-config.php file, save it and upload it to your web hosting account and you’ll be good to complete the installation process of your hosted WordPress website.

 

Comments

  1. pikul says

    I go to wp _config php in my ftp clients and open it everything you mentioned above, was already there. I Access PHPMyAdmin there is not thing is 0 no data of my website
    2 days a go I got 500 Internal Error and my hosted send me all the username and password ** I suggest you to update the database information or upload the database to your account from your local backup. ** I still don’t know how to do it pls some one help me

    thanks pikul

Leave a Reply

Your email address will not be published. Required fields are marked *

This blog is kept spam free by WP-SpamFree.