1. Knowledge Base
  2. >
  3. Setting up CodeGuard – Database

Setting up CodeGuard – Database

 

After backing up your website files, don't forget to back up your databases! Website databases must be manually added to the CodeGuard Dashboard so CodeGuard can create a backup for it.

Is your website built with WordPress? If yes, you will need to add your database to CodeGuard manually. Much of your WordPress website is contained within the database and is required to restore your site if something happens.

What you should know
  • Databases will NOT be automatically added to CodeGuard and must be manually connected.
  • CodeGuard will notify you if you have exceeded the CodeGuard limit or if you need to upgrade to the next plan or delete old backups to free up space.
  • CodeGuard will not affect or be affected by CDN networks because it is set up via FTP/SFTP.
  • CodeGuard only creates backups of your website files and databases and does not back up email accounts associated with your website's domain.
  • CodeGuard does not offer malware scans and monitoring. As a HostGator customer, check out our SiteLock security plans.

Adding a database to CodeGuard

Step: 1 Gather the database information

To add your database manually to the CodeGuard Dashboard, you'll need to find your database information:

Items NeededDescription
Database Hostname or IPUse the server IP address or server name. Please refer to this article to find your server address: What is My Server Address?
Database NameThe Database Name is a unique name assigned to the specific database that your site uses.
MySQL UsernameThe MySQL Username is the account used to access the database. This might be similar to your Database Name if you used Softaculous to install your app or WordPress.
MySQL PasswordThe password was created to log into the database. If you used Softaculous, it automatically generated the MySQL password.
MySQL Port Number3306
Where do I find my Database Name, MySQL Username, and MySQL Password?

To obtain the database information, you must access the account's files to open the WordPress wp-config.php file containing the database information. The following are the steps to instruct you on accessing this file. 

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

    cPanel File Manager

  3. This will log you directly into your File Manager for your hosting account.

    cPanel File Manager

  4. Access the folder where the WordPress application is located. Look for the wp-config.php file.
  5. Right-click on the wp-config.php and click View from the menu. Alternatively, you can click on the icon for the wp-config.php file and then click on the View icon at the top of the page.

    cPanel File Manager view wp config

  6. In the wp-config.php file, find the line that says:
    • DB_NAME
    • DB_USER
    • DB_PASSWORD
    • DB_HOST

    HostGator File Manager wp-config Database

  7. Take note of what is stated between the quotes for your database information, as this is needed to configure the database connection in the CodeGuard dashboard.
    Items NeededWhere it's located in the wp-config.php fileWhat information do you need for CodeGuard
    Database Hostname or IP 111.222.333.444
    (Located in cPanel to the right under Shared IP Address if you are on a Shared Hosting account)
    Database Name Define ( ‘DB_Name’, ‘db_example’ ); db_example
    MySQL Username Define ( ‘DB_USER’, ‘db_user77’ ); db_user77
    MySQL Password Define ( ‘DB_PASSWORD’, ‘dbp@sswOrd’ ); dbp@sswOrd
    MySQL Port Number 3306

Step 2: Configure the database

Once you've gathered this information, you should:

  1. Log into your CodeGuard Dashboard in your Customer Portal. 
  2. In the CodeGuard dashboard, next to your website, click the gear icon and select Add Database.

    cPanel CodeGuard Add Database

  3. Enter your database hostname or IP address and click Test Connection.

    CodeGuard Database Test Connection

  4. The Test Connection ensures that no firewall rules block a connection from our IP addresses. When all of the checks passes, select Next Step.

    CodeGuard Database Check Firewall

  5. Ensure that the IP addresses provided by CodeGuard are whitelisted in your hosting control panel.

    CodeGuard Database Check Connection
    Below are the instructions for whitelisting your IP address provided by CodeGuard within cPanel:

    1. Log in to your cPanel.
    2. Scroll down to the Databases section.

      HostGator cPanel Databases section

    3. Click on the Remote MySQL icon.

      HostGator cPanel Databases Remote MySQL

    4. In the Host field, enter the IP address provided by CodeGuard.

      HostGator Remote MySQL Host Field

    5. Click the Add Host button.

      HostGator Remote MySQL Host Add Host

  6. Enter the username and password for your MySQL database and click on Next Step.

    CodeGuard Database Add Credentials

  7. You'll see a list of all the databases to which you've added your MySQL user. Select the databases that you'd like to back up. If you want them all, click Select All. Once selected, click Add Databases.

    CodeGuard Database Add Database

  8. The backups of your database have begun! For the initial backup, you will be shown a progress tracker. It will walk you through the initial backup of the database step by step. You are not required to watch this if you do not wish to. When the initial backup is completed, you will be notified via email.

    CodeGuard Database Results

  9. Once the backup is complete, you'll see your backup in the dashboard.

    CodeGuard Database List

  10. Congratulations! You have added your database(s) to CodeGuard successfully!