MySQL dump and restore

#create dump file
mysqldump -u root -p db_test1 > test.db

#load dump file to database
mysql -u root -p db_test2 < test.db

if an error thrown :
ERROR 2006 (HY000) at line XX: MySQL server has gone away

find and uncomment/add with a value like below or higher :
max_allowed_packet = 16M 
located in my.ini(windows) or /etc/my.cnf(linux) and restart mysql server.

that error is usually because of the large dump file.

reference : http://icesquare.com/wordpress/error-2006-hy000-at-line-172-mysql-server-has-gone-away/

0 comments:

Post a Comment