Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set foreign_key_checks = on error wordpress

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

like image 469
Aakanksh Patel Avatar asked May 19 '17 13:05

Aakanksh Patel


2 Answers

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
like image 192
Vinit Goswami Avatar answered Nov 08 '22 06:11

Vinit Goswami


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?

like image 37
Gufran Hasan Avatar answered Nov 08 '22 06:11

Gufran Hasan