Errors restoring MySQL database dump on WAMP environment

You have maybe happened to get lots of errors when sourcing a .SQL database dump into a new WAMP installation, looking like these:

ERROR 1231 (42000): Variable ‘time_zone’ can’t be set to the value of ‘NULL’
ERROR 1231 (42000): Variable ‘sql_mode’ can’t be set to the value of ‘NULL’
ERROR 1231 (42000): Variable ‘foreign_key_checks’ can’t be set to the value of ‘NULL’
ERROR 1231 (42000): Variable ‘unique_checks’ can’t be set to the value of ‘NULL’
ERROR 1231 (42000): Variable ‘character_set_client’ can’t be set to the value of ‘NULL’
Query OK, 0 rows affected (0.00 sec)

ERROR 1231 (42000): Variable ‘collation_connection’ can’t be set to the value of ‘NULL’
ERROR 1231 (42000): Variable ‘sql_notes’ can’t be set to the value of ‘NULL’

The above errors where thrown trying to restore a Drupal database dump and lead to think there’s a clash among MySQL servers versions.

However, it all has to do with the maximum allowed size of blog fields within the database which defaults to 16MB.

Try to make it arbitrarily high temporarily by typing in:

mysql> set global max_allowed_packet=1000000000;

Then source your dump again:

mysql> source ./my_db.sql;

Finally restart your Wamp server to leave max_allowed_packet back to its default value.

Advertisements

4 thoughts on “Errors restoring MySQL database dump on WAMP environment

  1. Doesn’t solve:

    13:04:48 /*!50106 SET TIME_ZONE= @save_time_zone */ Error Code: 1231. Variable ‘time_zone’ can’t be set to the value of ‘NULL’ 0.000 sec

  2. Thanks for the post. I banged my head against the wall with this for a couple of hours trying to change the variables’ values in the export itself. Cheers!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s