How to configure a database in WordPress?

It is unnecessary to manually install WordPress as it can be quickly installed via Softaculous; however, if you want a more technical option, this article will cover the steps needed to install WordPress manually.

Here are the steps in installing WordPress manually.

We created video tutorials for building your WordPress website! See the section below ⤵.

No domain name for your WordPress site yet? Register a new domain through our front-of-site hostgator.com/domains! If you need help in choosing and registering your domain name, please visit these support articles.

  • Choosing Your Domain Name

Step 1: Download WordPress

  1. Download the WordPress package to your local computer from https://wordpress.org/download/.
  2. Unzip the downloaded file to a folder on your local computer.

Step 2: Upload WordPress to hosting account

There are three available options for uploading WordPress to your hosting account. When you unzipped the file in Step 1, you were left with a folder named wordpress, and the contents need to be uploaded to your hosting account's file manager. You can accomplish this one of three ways:

  • Upload via FTP - See How to Manage Files with Filezilla for more information.
  • Upload via File Manager - See How to Upload Using the File Manager for instructions.
  • Upload via SSH - See How to Get and Use SSH Access for instructions.

Step 3: Create MySQL database and user

WordPress stores its information in a database. Therefore, a database will need to be created.

  1. Log in to cPanel.
  2. Look for the Databases section, then click the MySQL Database Wizard icon.

    How to configure a database in WordPress?

  3. For Step 1: Create A Database, enter the database name, and click Next Step.

    How to configure a database in WordPress?

  4. For Step 2: Create Database Users, enter the database user name and password, and click Create User.

    How to configure a database in WordPress?

  5. For Step 3: Add User to the Database, click the All Privileges checkbox and click Next Step.

    How to configure a database in WordPress?

  6. For Step 4: Complete the task, make a note of the database name, username, and password, as you will need them for ⤵ below.

    How to configure a database in WordPress?


Step 4: Configure wp-config.php

The wp-config-sample.php file contains the database information and tells the WordPress application from which database to pull data. This step must be completed to ensure the correct database information is associated with the WordPress installation.

The wp-config-sample.php file can be found in File Manager in the folder where WordPress is installed. The folder for your primary domain is public_html by default, so the steps below show the process for that folder.

  1. Log in to cPanel.
  2. Navigate to the Files section, then click the File Manager icon.

    How to configure a database in WordPress?

  3. From the left-hand navigation menu in File Manager, click public_html.
  4. Click on the Settings button found on the top right-hand corner of your File Manager.

    How to configure a database in WordPress?

  5. In the pop-up box, check the box for Show Hidden Files (dotfiles), then click Save.

    How to configure a database in WordPress?

  6. In the right-hand panel of the File Manager, locate the wp-config-sample.php file.

    How to configure a database in WordPress?

  7. Right-click on the file, then select Rename.
  8. Change the name of the file to wp-config.php, then click the Rename File button to save the change.
  9. Right-click again on the new wp-config.php file and select Edit.
  10. A second pop-up box will appear. Click the Edit button.
  11. When the file opens, look for the following information:
    /** The name of the database for WordPress */ 
    define( 'DB_NAME', 'database_name_here' ); 
     
    /** MySQL database username */ 
    define( 'DB_USER', 'username_here' ); 
    
    /** MySQL database password */ 
    define( 'DB_PASSWORD', 'password_here'' ); 
    
    /** MySQL hostname */ 
    define( 'DB_HOST', 'localhost' );
    • Replace database_name_here with the name of the database you created (above in  ⤴).
    • Replace username_here with the username of the database you created.
    • Replace password_here with the password of the database that you created.

    Note: Make sure there are no spaces before or after your database name, username, and password.

  12. Once done, click the Save Changes button on the top right, then Close to exit and return to the File Manager.

Step 5: Run the installation

Open a new browser window and enter your domain to run the installation script. Depending on where you installed the script, you will be automatically redirected to either of the following URLs:

If you uploaded WordPress to the domain's root folder, you should be redirected to:

https://example.com/wp-admin/install.php

If you uploaded WordPress to a subfolder of your domain's directory, then the URL will be this format:

https://example.com/yoursubfolder/wp-admin/install.php

Be sure to replace 'example.com' with your actual domain name.


Step 6: Complete the installation

  1. Once you access your correct WordPress URL in a browser, you will see a WordPress setup page prompting you to select your preferred language. Select your preferred language and click the Continue button.

    How to configure a database in WordPress?

  2. You should now see a welcome page that says, "Welcome to the famous five-minute WordPress installation process!" Under the Information needed section, you'll need to fill out the following fields:

    How to configure a database in WordPress?

    • Site Title - This can be changed at a later time.
    • Username - This is the admin username for the site. We highly recommend using something other than 'admin' since using it can pose a security risk.
    • Password- A strong password will be automatically generated for you, but you can choose your own. The strength indicator will let you know how secure your password is.
    • Your Email- Login information will be sent to this email address, so make sure it is an email address you have access to.
    • Search Engine Visibility- If you want your website to show up in search engine results, leave this unchecked. If you do not want your site indexed, then you can check this box.
  3. Click the Install WordPress button, and you should be taken to the final screen, which says, "WordPress has been installed. Thank you, and enjoy!". It will display the username you chose on the previous page and a placeholder for your password. Click the Log In button to log in to the WordPress Admin Dashboard to begin building your site!

Now that you have WordPress installed, make sure to protect your site by signing up today for SiteLock, your cyber sentry for your website! SiteLock will block the bad guys, automatically remove malware, defend against malicious attacks, and more.


Additional Resources

Done installing WordPress? If you need assistance in building your WordPress website, here are video tutorials we created to get you started.

How do I setup a WordPress database?

How To Create a WordPress Database.
Log in to your cPanel..
Click the MySQL Database Wizard icon under the Databases section..
Enter the database name in the Create Database Users area, and click Next Step..
In Create Database Users, enter the database user name and password..

Where is database config in WordPress?

One of the most important files in your WordPress installation is the wp-config.php file. This file is located in the root of your WordPress file directory and contains your website's base configuration details, such as database connection information.

Can you use a database with WordPress?

Databases are an essential part of WordPress sites. They store data and files and ensure your website works well.

How do I change my database settings in WordPress?

Log in to cPanel..
Click the File Manager button under Files category..
If both DB_NAME and DB_USER matched with what's in the wp-config. ... .
In MySQL Databases, scroll down to Current Users..
Click on the corresponding Change Password link of the DB_USER..
Open the wp-config. ... .
Save changes..