Error (near “ON” at position 25) while importing Table for WORDPRESS ( A foreign key Error)

后端 未结 8 1878
野的像风
野的像风 2020-12-23 12:00

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.

    Un         


        
相关标签:
8条回答
  • 2020-12-23 12:10

    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.

    0 讨论(0)
  • 2020-12-23 12:14
    1. Goto XAMPP control panel>
    2. Stop Apache and MySql services>
    3. 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

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

    5. Again Start the services and try.. i hope it will work.
    0 讨论(0)
  • 2020-12-23 12:20

    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
    
    0 讨论(0)
  • 2020-12-23 12:21

    This happens because of the importing connectivity issue with phpmyadmin when you import large DB, here is how you can import large data base to the phpmyadmin. First change the following files according to your DB size.


    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
    

    then run the shell from xampp control panel and enter the following command.

    #mysql -p -u root DBname < c:\xampp\DBfolder\db.sql
    
    EnterPassword: (usually it is blank).
    

    then the process will start. :):):)

    0 讨论(0)
  • 2020-12-23 12:24

    For me my main goal was to make a stage site for my wordpress site, which had wordfence on it.

    I was using plesk obsidian and had to update mariadb to get past the error in the main question here Error (near “ON” at position 25) while importing Table for WORDPRESS ( A foreign key Error) which I was able to do by reading this blog article - https://support.plesk.com/hc/en-us/articles/213403429-How-to-upgrade-MySQL-5-5-to-5-6-5-7-or-MariaDB-5-5-to-10-0-10-1-10-2-on-Linux-

    That took forever but got me passed the above error, but then I was getting this error on db import:

    #1062 - Duplicate entry '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xEF\xBF\xBD\xEF\xBF\xBD' for key 'PRIMARY' when find and replace domain on wordfence

    I was doing the domain find and replace in vscode "mydomain.com" with "stage.mydomain.com". The problem turned out to be that wordfence saves binary data or something to the database, and just opening it in vscode and saving it was altering that somehow, and thus throwing obscure duplicate entry error for primary key

    The fix for the above was to not open, or alter, the .sql file in vscode but to do the find in replace with linux. This was the commands I ran to do this on Mac -

    find and replace http: with https: -

    perl -pi -w -e 's/http:\/\/mydomain.com/https:\/\/mydomain.com/g;' my_db_file.sql

    find and replace mydomain.com with stage.mydomain.com -

    perl -pi -w -e 's/mydomain.com/stage.mydomain.com/g;' my_db_file.sql

    0 讨论(0)
  • 2020-12-23 12:26

    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
    
    0 讨论(0)
提交回复
热议问题