Akberov
Akberov

Reputation: 164

MySQL server has gone away when importing WordPress sql file

I downloaded live Wordpress website to my local machine to work on it over my local environment. Since database file is missing, the webpage was not the same as it was on production. So I exported, dumped the sql file using SSH , and now I try to import it to my local XAMPP envinornent with my Mac Terminal using the command below:

mysql -h127.0.0.1 -u root -p wp_database < ../../wp.sql;

And Terminal throws this error:

ERROR 2006 (HY000) at line 899: MySQL server has gone away

What could be the reason for this problem?

What I've done to solve the problem:

1) I've upgraded max_allowed_packet to 128MB

2) I've upgraded innodb_lock_wait_timeout = 60000

3) I've upgraded innodb_log_file_size = 128M

Upvotes: 1

Views: 4254

Answers (2)

seravee
seravee

Reputation: 434

Try the below code

mysql -h127.0.0.1 -u root -p --max_allowed_packet=1073741824 wp_database < ../../wp.sql --verbose --force --wait --reconnect

Upvotes: 1

Muhammad Saqlain
Muhammad Saqlain

Reputation: 2212

After setting max_allowed_packet did you restarted server?

Try passing directly to client. Once i faced this issue and global update and the my.cnf settings didn't work for me but this worked.

mysql -h127.0.0.1 -u root -p --max_allowed_packet=1073741824 wp_database < ../../wp.sql;

Upvotes: 2

Related Questions