I can’t import my database into mysql

Posted on

Question :

I have a website based on drupal and I tried to export its database via both Backup wizard and phpmyadmin. the database was exported but I can’t import it on my localhost database.this the error

Error

SQL query:

INSERT INTO cache_form (cid, data, expire, created, serialized) VALUES (‘form_form-oXe_wKiLXaY4CMmjjZfsXJfVqJagaRk2_6Ty33MDJXI’, 0x613a34343a7b733a31353a22236e6f64655f656469745f666f726d223b623a313b733a31313a222361747472696275746573223b613a313a7b733a353a22636c617373223b613a323a7b693a303b733a393a226e6f64652d666f726d223b693a313b733a32393a226e6f64652d6d61617265665f67686f72616e5f73617965722d666f726d223b7d7d733a333a226e6964223b613a323a7b733a353a222374797065223b733a353a2276616c7565223b733a363a222376616c7565223b733a333a22313033223b7d733a333a22766964223b613a323a7b733a353a222374797065223b733a353a2276616c7565223b733a363a222376616c7565223b733a333a22313033223b7d733a333a22756964223b613a323a7b733a353a222374797065223b733a353a2276616c7565223b733a363a222376616c7565223b733a313a2231223b7d733a373a2263726561746564223b613a323a7b733a353a222374797065223b733a353a2276616c7565223b733a363a222376616c7565223b733a31303a2231333835303231363438223b7d733a343a2274797065223b613a323a7b733a353a222374797065223b73[…]

MySQL said: Documentation

2006 – MySQL server has gone away

the database works well on remote server, the website works but I can’t import it on localhost.

thanks

Answer :

I’ve see at least two problems:
1. fields list doesn’t match values.
2. serialized data doesn’t quoted properly.

May be you have try native mysqldump instead of “Backup wizard”?

mysqldump 
-u USERNAME -pPASSWORD 
--opt                  
--no-create-db         
--comments             
--complete-insert      
--order-by-primary     
DATABASENAME  > ./dbdump.sql

Keep in mind that there is no space between -p and PASSWORD.

I solved the problem this way: set max_allowed_packet = 4M to the file my.ini

Leave a Reply

Your email address will not be published.