Error (near “ON” at position 25) while importing T

2019-03-11 04:41发布

问题:

I try to import a large file to my Database (WordPress), it shows some error like this:

Error

Static analysis:

1 errors were found during analysis.

    Unrecognized keyword. (near "ON" at position 25)

SQL query: Edit Edit

SET FOREIGN_KEY_CHECKS = ON;

MySQL said: Documentation
#2006 - MySQL server has gone away

回答1:

I had the same error when I tried to migrate Drupal database to a new local apache server(I am using XAMPP on Windows machine). Actually I don't know the meaning of this error, but after trying steps below, I imported the database without errors. Hope this could help:

Changing php.ini at C:\xampp\php\php.ini

max_execution_time = 600
max_input_time = 600
memory_limit = 1024M
post_max_size = 1024M

Changing my.ini at C:\xampp\mysql\bin\my.ini

max_allowed_packet = 1024M


回答2:

  1. Goto XAMPP control panel> 2.Stop Apache and MySql services>
  2. Click on Config of Apache>select php.ini and change the followings:
    max_execution_time = 600
    max_input_time = 600
    memory_limit = 1024M
    post_max_size = 1024M

  3. Click on Config button of MySql and select my.ini and change:
    max_allowed_packet = 1024M

  4. Again Start the services and try.. i hope it will worksssss.


回答3:

I had the same problem when trying to import a Wordpess MySQL dump to a new server. In the end after an hour debugging I had to manually remove the following tables from the .sql file:

wp_cf7dbplugin_st wp_cf7dbplugin_submits

There were some really large values (possibly PDF files) stored in some of the fields which were causing a problem.

Imported fine after I removed the tables from the script.