Showing posts from February, 2017

[Solution] MySQL Command line import - MySQL has gone away

To people who have problem importing a large (over 5XX MB) SQL text file:

If you are having problem of importing a large SQL file with over 5XX MB, you will get an error:

MySQL has gone away.

Even if you are using command line import.

While raising max_allowed_packet to a very high value (> 800 MB) still not help.  You can do this:

Login to mysql command line tool using: mysql -u<username> -p, and then enter passwordRaise max_allowed_packet INSIDE the mysql console (Reference here) by typing: "set global max_allowed_packet=1*1024*1024*1024".  The value is in bytes.  So I type the equation here, which is equal to 1G.  Yes I know this is crazy...When you see "mysql>", you type "source <SQL_file_name>".  I put the SQL file together with the mysql.exe (I am using windows) so the above command works for me.  You may need to adjust your path in order to make it work.  By running this command the SQL file will be parsed and run statement by stat…