Skip to main content

Migrate Guru fails with "Error while creating the table wp_posts"

Why Migrate Guru migrations to Wordify stop at wp_posts when the old server runs MySQL with ANSI_QUOTES, and the one-line fix.

Written by Daniel

If Migrate Guru stops with "Error while creating the table wp_posts. Please contact support team." and every retry fails at the same point, the usual cause is a setting on the server you're migrating from, not the destination. This article explains what's happening and gives you a one-line fix.

Who this applies to

Anyone moving a WordPress site to Wordify with the Migrate Guru plugin, on any plan. The same cause also breaks manual database imports: phpMyAdmin or the MySQL command line will fail with an error like #1064 You have an error in your SQL syntax ... near '"wp_actionscheduler_actions" ('.

What's going on

MySQL has an option called ANSI_QUOTES. When it's switched on, the server writes table and column names inside double quotes, like "wp_posts", instead of the usual backticks, like `wp_posts`.

Migrate Guru copies each table by asking your old server for the table definition and replaying it on the new one. If the old server has ANSI_QUOTES on, the definition arrives with double quotes. Standard MySQL and MariaDB servers, including Wordify's, treat that as a syntax error, so the very first table fails and the migration stops. The error names wp_posts simply because it's the first table Migrate Guru creates.

This is uncommon. Most hosts run the MySQL default, which doesn't include ANSI_QUOTES. It usually shows up on self-managed servers where someone has set sql_mode by hand.

How to check

If you can run a query on the old site's database (through phpMyAdmin, Adminer, or a database plugin), run this:

SHOW VARIABLES LIKE 'sql_mode';

If the result contains ANSI_QUOTES or ANSI, this article is for you.

The fix

You only need to change one function in the Migrate Guru plugin on the source site (the site you're migrating away from). It tells the plugin to read table definitions with the standard quoting so the destination accepts them.

Here is what the finished function looks like. The new line is the one containing SET SESSION sql_mode; the other three lines are already there and stay exactly as they are.

public function showTableCreate($table) {

$this->query("SET SESSION sql_mode = ''");

return $this->getVar("SHOW CREATE TABLE $table;", 1);

}

  1. Log in to the old site's WordPress admin.

  2. Go to Plugins then Plugin File Editor.

  3. In the "Select plugin to edit" dropdown, choose Migrate Guru and click Select.

  4. In the file list on the right, open wp_db.php.

  5. Find the function that starts with public function showTableCreate($table) {. It's near the top of the file.

  6. Add the SET SESSION sql_mode line directly beneath that opening line, as shown above.

  7. Click Update File.

  8. Run the migration again from Migrate Guru as normal. It should now get past wp_posts and copy every table.

The change only affects how Migrate Guru reads table definitions during the migration. It doesn't alter your old site's data or settings, and the plugin is removed after the move anyway.

If the Plugin File Editor is missing

Some hosts disable the file editor. In that case, make the same one-line edit to wp-content/plugins/migrate-guru/wp_db.php over SFTP or your host's file manager, or ask us to handle the migration for you (see below).

If you migrated with a database export instead

A SQL dump taken from a server with ANSI_QUOTES on has the same double-quoted names and fails to import on Wordify with a #1064 syntax error on the first CREATE TABLE. Send the dump to us through a migration request and we'll import it with the matching setting, or import it yourself with mysql --init-command="SET SESSION sql_mode='ANSI_QUOTES'".

Need help?

Migrations to Wordify are free on every plan. If you'd rather not edit plugin code, open a migration request from the Console and give us a WordPress admin login for the old site. We'll apply the fix and move the site for you. Support is available 24/7 with a one-hour response time.

Did this answer your question?