15

I have Bluehost account and now i am transferring to new account digitalocean.com i am doing export and import as we do in the phpmyadmin but here when i import my sql.zip or sql.gz files in new server it show me error like

Error
Static analysis:

1 errors were found during analysis.

Missing expression. (near "ON" at position 25)
SQL query: Edit Edit

SET FOREIGN_KEY_CHECKS = ON;

MySQL said: Documentation

#2006 - MySQL server has gone away

Here is the screen shot

https://www.awesomescreenshot.com/image/2511553/fa78fad9e1108051c84538f2314df7

i do following steps to resolve issue

  1. try to export by MYSQL_40 and import
  2. try by disabling the FOREIGN_KEY checkbox when export and try to import
  3. Used the database plugin but same error

But no luck i think it is an issue with bluehost server when i am trying to export

Aakanksh Patel
  • 603
  • 1
  • 8
  • 21
  • Check out this post: https://stackoverflow.com/questions/33974492/error-while-importing-wp-options-table-for-wordpress-a-foreign-key-error see if it helps. – Cesar Martinez Dominguez Aug 31 '17 at 09:11
  • @CesarMartinezDominguez thanks for the reply but I check this options as well not luck and at the end, I change the server and migrate to HostGator and also the support of Bluehost is worst. I am not saying I am right but they should have technical support like HostGator & wpengine. – Aakanksh Patel Aug 31 '17 at 10:46

3 Answers3

13

After checking lots of solutions finally i found the correct one, my wordpress database size was 100mb.

Changing php.ini at C:\xampp\php\php.ini
max_execution_time = 600
max_input_time = 600
memory_limit = 1024M
post_max_size = 1024M
user_ini.cache_ttl = 15000
Changing my.ini at C:\xampp\mysql\bin\my.ini</b>
max_allowed_packet = 1024M
Vinit Goswami
  • 131
  • 1
  • 2
5

This Error, Mostly We get while importing the database from PhpMyAdmin. I solved it by importing database through commands.

mysql -u username -p database_name < file_name.sql

or by changing in database file_name.sql as:

  1. put this line SET FOREIGN_KEY_CHECKS = 0; just the beginning of database file_name.sql.

  2. And put this line SET FOREIGN_KEY_CHECKS = 1; just before the end of file at last line of file_name.sql.

Note: The first line will disable foreign key checks and the last line will enable it again.

How to import an SQL file using the command line in MySQL?

Gufran Hasan
  • 8,910
  • 7
  • 38
  • 51
1

once it happened to me It's because you've been using MariaDB 10.3 and now you changed the version to lower take a backup change or update/upgrade the version of your mariadb or mysql to the latest and then it will be ok

SaeedTJ
  • 33
  • 7