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

Download our exclusive 10-Point WP Hardening Checklist:
Edit wp-config.php To Add WordPress Database Credentials | WP Learning Lab

In another video (here: 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 ( 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

2. Buying A Domain Name For Your Website (From GoDaddy) – Tips & Tricks of the Pros

3. WordPress Hosting: Buying A (BlueHost) Hosting Account for Your Website

4. Setting Name Servers In Your GoDaddy Domain Registrar Account

5. Create Add On Domains via cPanel

6. Downloading and Uploading WordPress.org (Self Hosted WordPress) Files

7. Create a MySQL Database for your WordPress Site via cPanel

8. Edit wp-config.php To Add WordPress Database Credentials

9. WordPress Installation Form & Logging In For The First Time

10. WordPress One Click Install

11. Create A Custom Email Address For Your Website Via cPanel

12. Forward Your Custom Email Address via cPanel

13. WordPress Installation Series Conclusion & Next Steps


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

Connect with us:

WP Learning Lab Channel:



Google Plus:


Nguồn: https://marishka-moi.com/

Xem thêm bài viết: https://marishka-moi.com/category/cong-nghe

17 Replies to “Edit wp-config.php To Add WordPress Database Credentials | WP Learning Lab”

  1. Kod ovog idiota nista nikad nisam nasao sta mi trebaju, nabijem na kurac i njega i sve ove koji mu se zahvaljuju na nebuloznim resenjima!

  2. 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?

  3. 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

  4. 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?

  5. 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' );

  6. 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.

  7. 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?

  8. 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…

  9. 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."

Leave a Reply

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