Title: &quot;Sync failed. SQL error.&quot;
Last modified: August 21, 2016

---

# "Sync failed. SQL error."

 *  Resolved [weareglass](https://wordpress.org/support/users/weareglass/)
 * (@weareglass)
 * [12 years ago](https://wordpress.org/support/topic/sync-failed-sql-error/)
 * Sync failed. SQL error.
 * I got that error message trying to pull from a database. The WP install I’m pulling
   from is on a remote server and the one I’m pulling into is on a local installation
   using MAMP. When I try to push the database to my MAMP machine I get this error:
 * Remote site not accessible (HTTP 0)
 * Any help would be much appreciated.
 * [https://wordpress.org/plugins/database-sync/](https://wordpress.org/plugins/database-sync/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [wellplayedsir](https://wordpress.org/support/users/wellplayedsir/)
 * (@wellplayedsir)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/sync-failed-sql-error/#post-4960511)
 * I’m getting the same exact problem, too. Can’t figure it out. Any help here?
 *  [simoneast](https://wordpress.org/support/users/simoneast/)
 * (@simoneast)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/sync-failed-sql-error/#post-4960538)
 * +1. Getting the same error message.
 *  [JustinTheClouds](https://wordpress.org/support/users/justintheclouds/)
 * (@justintheclouds)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/sync-failed-sql-error/#post-4960540)
 * I’m getting the same error and was able to track it down to “No database selected”.
   That’s as far as I got since I’m on a time crunch. Maybe this information can
   help someone else get it fixed before I’m able to get to it.
 *  [Simon East](https://wordpress.org/support/users/simonyump/)
 * (@simonyump)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/sync-failed-sql-error/#post-4960541)
 * I found a fix. Unfortunately the plugin uses old/deprecated MySQL functions instead
   of the WPDB class. One line appeared to get the syncing to work again for me.
 * In /wp-content/plugins/database-sync/functions.php, around line 46
 * CHANGE:
 *     ```
       if (mysql_query($query) === false) {
       ```
   
 * TO:
 *     ```
       global $wpdb;
       if ($wpdb->query($query) === false) {
       ```
   
 * I will try and submit a patch to the author so that the plugin can be fixed in
   the repository.
 * Simon.
 *  Plugin Author [tamlyn](https://wordpress.org/support/users/tamlyn/)
 * (@tamlyn)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/sync-failed-sql-error/#post-4960542)
 * Please try the latest version 0.3 which fixes this problem. Thanks to Simon East
   for the patch.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘"Sync failed. SQL error."’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/database-sync.svg)
 * [Database Sync](https://wordpress.org/plugins/database-sync/)
 * [Support Threads](https://wordpress.org/support/plugin/database-sync/)
 * [Active Topics](https://wordpress.org/support/plugin/database-sync/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/database-sync/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/database-sync/reviews/)

 * 5 replies
 * 6 participants
 * Last reply from: [tamlyn](https://wordpress.org/support/users/tamlyn/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/sync-failed-sql-error/#post-4960542)
 * Status: resolved