We have recently setup CodeGuard for one of our clients, and we’re in the process of setting up numerous sites on the CodeGuard platform. Getting the files adding for backup was as easy as providing FTP credentials. Backing up the database, however, proved to be a bit more difficult.
If you’re having trouble setting up database backups for CodeGuard on a GoDaddy shared hosting plan, it’s likely due to the following configuration option.
NOTE: This is not only true for CodeGuard backups. This is true for any third-party service that you want to access your database. It could be a backup solution, security analysis, integration with another website, etc.
Allow Direct Database Access on GoDaddy Shared Hosting
When creating a new database on a GoDaddy shared hosting plan (instructions here), there is an option to “Allow Direct Database Access.” It’s buried under an “Additional Options” toggle, and it’s set to NO by default.
If you do not allow direct database access, CodeGuard will not be able to backup your database.
And after talking to GoDaddy customer support, they confirmed that you cannot change this option once you’ve setup your database. It has to be configured when you first create the database.
A Solution To Fix This Problem
The following solution uses GoDaddy’s internal tools for backing up & restoring databases. You could alternatively access the old database via phpMyAdmin, export the database, create a new one, allow direct database access, and then import the .sql file you exported. If you’re comfortable with phpMyAdmin, that’s a perfectly viable solution.
Login to your GoDaddy Hosting Control Panel.
Scroll to the bottom & look for “Databases.” Click the “MySQL” icon.
Next to the database you need to allow direct access for, click the “Actions” button, and choose “Back Up.”
Once your database backup is complete, click the “Add” button to add a new database. Give your new database a new name, but this time, make sure you select YES for “Allow Direct Access.”
Once the new database is setup, click the “Actions” button next to it, and choose “Restore.” You should have an option to restore the database that you just backed up. Select it.
After The Database Is Created
If you’re using a CMS, you’ll want to make sure you update your database credentials with the new database name, username & password. With GoDaddy, typically, the database name & username are the same thing.
If you’re using WordPress, open your wp-config.php file, and edit the database settings. You want to make sure your new database has been setup properly, and the restore is complete, before you do this.
Even GoDaddy themselves state that allowing direct database access is less secure. In no way am I suggesting you allow this option. I’m simply providing a solution to what I think might be a common problem. Enabling this option is entirely at your discretion.
By no means am I promoting GoDaddy’s hosting, either. GoDaddy’s shared hosting is not the best solution out there. It’s comparatively slow, and less secure, than other, more robust options.