Knowledge Base
How to add your HostGator VPS or Dedicated Server database to CodeGuard
Overview
By the end of this article, your HostGator Virtual Private Server (VPS) or Dedicated Server database will be added to CodeGuard and backing up automatically. The article lists what you need before you start, then covers the three stages of the task: whitelisting the CodeGuard IP addresses through the Remote MySQL page in cPanel, creating a MySQL user with full permissions on the database, and collecting the database hostname, username, and database name so you can activate the database in CodeGuard. It closes with how to confirm the database was added, and troubleshooting for a failed connection test and for the MySQL port number.
Prerequisites
- An active CodeGuard account with the associated website already added.
- cPanel sign-in credentials for your HostGator VPS or Dedicated Server account.
- The MySQL port number for your server. This is 3306 unless it has been changed.
Stage 1 — Whitelist the CodeGuard IP addresses in cPanel
- Sign in to cPanel for your HostGator VPS or Dedicated Server account.
- Select Remote MySQL.
- Enter the CodeGuard IP addresses for your region in the Add Access Host field, one address at a time, and save each one.
| Region | CodeGuard address | IP addresses to whitelist |
|---|---|---|
| United States | codeguard.com | 54.236.233.46, 54.236.233.28, 54.174.91.34, 54.174.153.212, 54.174.115.171 |
| Germany | de.codeguard.com | 35.157.245.195, 18.185.35.20 |
| United Kingdom | uk.codeguard.com | 52.56.56.141, 35.178.158.59 |
| France | fr.codeguard.com | 52.47.143.35, 52.47.91.37 |
Add every address for your region, not only the first one. HostGator blocks connection attempts from addresses that are not listed here, so a database added without this step will fail its backups.
Figure 1,2 & 3: cPanel Remote MySQL page with the Add Access Host field
Stage 2 — Create a MySQL user for CodeGuard
- From the cPanel home screen, select MySQL Databases.
- Create a new user. Note the username and password. cPanel prefixes the name you type with an account-specific string, so the full username is longer than what you enter.
- Assign the new user to the database you want to back up.
- Grant the user All Privileges. Full permissions are required so that CodeGuard can both back up and restore the database.
Figure 4-7: cPanel MySQL Databases page where a user is created and assigned to a database
Stage 3 — Collect the database details
On the MySQL Databases page, note the three values CodeGuard needs:
| Value | Where to find it |
|---|---|
| Database hostname | The host portion at the start of the database address shown on the page |
| MySQL username | The full prefixed username created in Stage 2 |
| Database name | The full prefixed name of the database you assigned the user to |
Figure 8: MySQL Databases page with the hostname, username, and database name
Stage 4 — Add the database in CodeGuard
- Sign in to your CodeGuard account and select the website your database is associated with.
- Select Databases underneath the website address.
- Select Add Database.
- Enter the database hostname from Stage 3 and select Test Connection.
- Review the connection test result. If any address fails, return to Stage 1 and confirm that every CodeGuard IP address for your region is whitelisted in Remote MySQL. When the test passes, select Next Step.
- Enter the database username, password, and port number, then select Next Step.
- Select your database and select Add Database. If the MySQL user has access to more than one database, every one of them appears in this list. Choose the one you want to back up.
How to verify success
CodeGuard displays a confirmation once the database is added, and you can track progress while the first backup runs. CodeGuard sends you an email when the database has finished being added.
Troubleshooting
Issue: The connection test fails for one or more IP addresses.
Cause: Not every CodeGuard IP address for your region is listed on the Remote MySQL page, so HostGator blocks those connections.
Solution: Return to Stage 1 and add every address for your region, then run Test Connection again.
Issue: You do not know your MySQL port number.
Cause: The port has been changed from the default.
Solution: The MySQL port is 3306 unless it was changed. If you are not sure whether it was changed, contact HostGator support and ask them to confirm the port number for your server.
Issue: You cannot locate your database credentials.
Cause: The credentials were created by another administrator or are not recorded.
Solution: Use the sample email provided in the CodeGuard Add Database screen to request the correct credentials from your hosting provider. If you are still unable to add the database, contact CodeGuard support.
Similar questions
- How do I add a HostGator VPS database to CodeGuard?
- How do I back up my HostGator Dedicated Server database?
- What IP addresses do I add to Remote MySQL in cPanel for CodeGuard?
- Why does the CodeGuard database connection test fail on HostGator?
Related articles
Need assistance?
Contact our team for help with your purchase or issuing your certificate.