What is define( ‘DB_PASSWORD’, ‘password_here’ ) in WP-Config File?

Hey, do you often work with WordPress or keep writing about it? If so, then you surely do know a file with something like “ wp-config.php ” or “ wp-config-sample.php “.

This file is crucial for your WordPress site as it contains all the necessary information about your website and the address where it keeps its data. One can easily say that this is a key that instructs WordPress how to talk with the place where all the information about your website stays.

Overall, there is a line there that says: “ define(‘DB_PASSWORD’, ‘password here’); “. This is where you store the secret password that WordPress then uses to safely access the database.

I assure you that you will learn how to set up your WordPress site on your own with this file, as shown in the tutorial. 

So, let’s begin, and I will demonstrate how it is done.

How to Make Database Connection in WordPress?

I explained earlier that wp-config.php is one of your site’s most significant files and is found in the WordPress installation’s root directory. 

If you’re the one who installed WordPress on your server, you’ll need to add your database details to this document to complete the installation. 

Below is the blueprint for defining your database connection:

<?php

//** Database settings - You can get this info from your web host ** //

/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );

/** Database username */
define( 'DB_USER', 'username_here' );

/** Database password */
define( 'DB_PASSWORD', 'password_here' );

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

These are the parameters you require to connect to your database. 

Below is a highlight of each one of them;

  • DB_NAME: This is the name of the database you created when you installed WordPress manually.
  • DB_USER: This is the database username you use to access your database.
  • DB_PASSWORD: This is a password that allows the DB_USER to log in to the DB_NAME as you created the database previously.
  • DB_HOST: The DB_HOST has an address to your database server, which in most cases is “localhost’’ but in some cases, you may find a unique address.

Being familiar with some of the basics before creating a connection to our database, then we will also familiarise you on how to connect the database to your wordpress website. 

For you to create a connection between your database and your website to help you install WordPress on your website do the; Download wordpress from their official website; after doing that then, you will upload the wordpress files to your website’s root directory.

Your root directory is the public_html.

After uploading the files, unzip them and move them to the “public_html” folder except for files in the “wordpress” folder.

This step is followed by removing the “WordPress” folder so that your file manager does not look messy, as it has so many garbage files and folders.

Create a MySQL database and user, being required to keep the details then later assign the user to the database.

After you finish the above steps, rename the file “wp-config-sample.php” into “wp-config.php” and input your database details there. If you have done that, go to your website, www.example.com, and you will see the wordpress installation page as shown above.

Simply input your site’s details, and you are ready to go!

Final Thoughts!

In the end, the place where you input the WordPress database password is defined by the line that goes “define( ‘DB_PASSWORD’, ‘password_here’ );” in the wp-config file. I always urge people to choose strong passwords since you are supposed to protect your database from strangers with no business. 

For a strong password try to include 8 letters having both uppercase, lowercase, numbers and symbols. Do not go for something predictable like your birth date or anything that can easily be guessed. 

Again every site has its password, so don’t use the same password for every site . If you found this article helpful in any means, don’t forget to share it with friends and families.

Avatar of Shiwanshi
Shiwanshi
Hi, I'm Shiwanshi and I'm a content writer. My skills lies in blogging and writing with an aim to provide quality content to my readers.

Leave a Comment