Edit wp-config.php To Add WordPress Database Credentials | WP Learning Lab

Thomas , CA – Also forced me into another year after I cancelled – They too forced me into another year after I called to cancel my renewal. They recently switched their servers and lost all of their agreements and automatically billed any expired domains. After 4 phone calls and 11 emails they told me “too bad, read the terms of service”. Terrible customer service, will not own up to their mistakes and nickle and dime every account they have. Stay away.

Download our exclusive 10-Point WP Hardening Checklist: http://bit.ly/10point-wordpress-hardening-checklist
Edit wp-config.php To Add WordPress Database Credentials | WP Learning Lab

In another video (here: https://youtu.be/wtG1IJ1Wbvs) I showed you how to create a MySQL database for your WordPress site. In this video I’m going to show you how to edit wp-config.php file to include the database credentials.

Although many people will be intimidated by it, editing wp-config.php is quite easy once you know the steps. So I encourage you try.

The first thing you must do to edit config file is log into the root directory of your WordPress site. You can do this via FTP or the file manager in your hosting account, whatever you’re most comfortable with.

Find a file called wp-config-sample.php and open it for editing wp-config.php. Scroll down to where it says MySQL Settings. Just below that you will see three important entries:

1. define(‘DB_NAME’, ‘database_name_here’);
2. define(‘DB_USER’, ‘username_here’);
3. define(‘DB_PASSWORD’, ‘password_here’);

Carefully replace database_name_here with the MySQL database name you created. Make sure that the single quotes stay, you only want to replace the text database_name_here.

Replace username_here with the username you created and replace password_here with the password you created.

That’s all you need to install WordPress. You can save the file and exit or you can do a couple more tweaks that will make your site more secure.

If you want to exit now, simply save the file and close the text editor. Then make sure you change the file name from wp-config-sample.php to wp-config.php.

If you want to make some security tweaks then keep reading.

Scroll down in the wp config file to where it says Authentication Unique Keys and Salts. Keys and salts are unique characters that WordPress uses to make usernames and passwords extra hard for hackers to guess.

Go to the URL that is the instructions for the keys and salts (https://api.wordpress.org/secret-key/1.1/salt/). Refresh the page that loads a few times and then copy and paste the block of code that appears on that page. Paste that code block into the wp-config.php file replacing the demo code that exists. And you’re done with the unique keys and salts.

After that you can scroll down to where it says WordPress Database Table Prefix. By default the database prefix is wp_ and every hacker knows that. Every hacker also knows that 99% of webmasters don’t change the prefix. Hackers can take advantage of this information to gain access to your database. This is easily avoided.

Simply change the database table prefix to something random. You can only use letters and numbers and the underscore needs to be kept at the end of the prefix. For example, instead of wp_ you could make the prefix be tomfoolery_. The latter is much more difficult for a hacker to guess.

That’s it for basic wp-config.php security. You can now save the file, exit and rename it to wp-config.php.

I hope this information helps you! If you have any questions leave a comment below or ping me @WPLearningLab on Twitter.

All videos in the WP Learning Lab WordPress Installation Series:

1. WordPress Installation Introduction https://youtu.be/7jiMRKYcjq0

2. Buying A Domain Name For Your Website (From GoDaddy) – Tips & Tricks of the Pros https://youtu.be/qThIPLjjW5Y

3. WordPress Hosting: Buying A (BlueHost) Hosting Account for Your Website https://youtu.be/Amlw0VKbtRU

4. Setting Name Servers In Your GoDaddy Domain Registrar Account https://youtu.be/mlWBm4nL3R8

5. Create Add On Domains via cPanel https://youtu.be/vOjKns89Rj0

6. Downloading and Uploading WordPress.org (Self Hosted WordPress) Files https://youtu.be/O6IgVyxusro

7. Create a MySQL Database for your WordPress Site via cPanel https://youtu.be/wtG1IJ1Wbvs

8. Edit wp-config.php To Add WordPress Database Credentials https://youtu.be/QRKigi4ek_g

9. WordPress Installation Form & Logging In For The First Time https://youtu.be/qDGRcGTFOjs

10. WordPress One Click Install https://youtu.be/5L5fGL5egGk

11. Create A Custom Email Address For Your Website Via cPanel https://youtu.be/q4_1CeSU8XM

12. Forward Your Custom Email Address via cPanel https://youtu.be/n7sm8b5gUVY

13. WordPress Installation Series Conclusion & Next Steps https://youtu.be/ZJ3-gf3c-9o


If you want more excellent WordPress information check out our website where we post WordPress tutorials daily.


Connect with us:

WP Learning Lab Channel: http://www.youtube.com/subscription_center?add_user=wplearninglab

Facebook: https://www.facebook.com/wplearninglab

Twitter: https://twitter.com/WPLearningLab

Google Plus: http://google.com/+Wplearninglab

Pinterest: http://www.pinterest.com/wplearninglab/

WordPress Tutorials – WPLearningLab

  • NZFix
    Posted at 00:24h, 26 October

    Thanks so much my friend . your video has awsome information . i sought out my problem with the help of your video . thanks so much .

  • Rodrigo F. Spieagre amo meu Rottweiler
    Posted at 01:53h, 18 December

    amazing ๐Ÿ˜‰

  • King31j
    Posted at 02:10h, 24 February

    Which video was the one before this?

  • Ivan Lorenzo
    Posted at 15:12h, 20 May

    Hey you know, I've changed the wp-config-sample to wp-config.php but it said:
    "Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file to your WordPress installation."

  • Kana Pitpit
    Posted at 03:44h, 30 June

    Great video…Hi there. I am having an issue logging in my WordPress Admin. Just wanna know if wp-config.php entries such as "DB name", "DB username", etc. are Case Sensitive. Thanks in advance…

  • David S
    Posted at 03:06h, 06 July

    I did ALL what you said and went to my website and got the original website I have there (non WordPress site) and it's still there. What went wrong?

  • Baldio Baldi
    Posted at 03:15h, 02 August

    you are my herOOOOO.. thank you!!!!

  • Saida Fernandez
    Posted at 01:07h, 26 October

    thank you so much, I was able to get my site back & saved $$$ to get my hosting company restore it, which I had already pay them to restore b4. Great videos, clear to listen. Keep up the great job. Also tks to people like you that post free tutorials.

  • Saida Fernandez
    Posted at 01:12h, 26 October

    wished I could like your page thousands of time

    Posted at 17:40h, 21 August

    thanks for your tutorial but i have this problem can i got any help:

    I just moved my site from hosting A to hosting B server..

    I copied the DB and the Files
    Created a new DB and imported it..

    when I go to the site it has a window to download a file

    What did I miss?? Canโ€™t figure this out..

    * Front to the WordPress application. This file doesn't do anything, but loads
    * wp-blog-header.php which does and tells WordPress to load the theme.
    * @package WordPress

    * Tells WordPress to load the WordPress theme and output it.
    * @var bool
    define('WP_USE_THEMES', true);

    /** Loads the WordPress Environment and Template */
    require( dirname( _FILE_ ) . '/wp-blog-header.php' );

  • ุนู„ูŠ ู…ุญู…ุฏ
    Posted at 17:18h, 03 September

    thank you thank you thank you thank you thank you thank you

  • Magick Academy
    Posted at 04:36h, 06 September

    why do we want to store all this vital information in a config file? I am being hacked over and over each and every couple of hours on 17 websites I am being attacked. I have firewall from godaddy sucuri and it is useless. I am so exausted for the past week and a month before that I am deleting hundreds of files manually, hardening, scanning, changing passwords, I even rebuilt everything on a new hosting, same problem. Doesn't this info being in the sites files make you more vulnerable?

  • Actual Wizard
    Posted at 20:59h, 23 October

    Just press Ctrl + F5 to override the Mozilla Firefox cache.

  • Online
    Posted at 09:26h, 25 February

    Is it possible to run 2 config.php file. Like 1st config.php file runs for 6hrs and the next 2nd config.php runs next 6hrs

  • Talia Gutierrez
    Posted at 02:28h, 02 June

    I did all of this and got the info from your last video but when I go to my website, I get this message ; Error establishing a database connection ; do you know what I might be missing?