3

I've got a local mysql server running on my system, which I'm trying to load a massive existing database into from an sqldump file.

The first time I tried this after about an hour (or so) I got the following error

'ERROR 2013 (HY000): Lost connection to MySQL...

It seems I might be able to sort this out be rectified by increasing the --wait_timeout command line option.

My question is - how can you start mysql server as a service and pass it command line options in Ubuntu?

To start and stop normally I use

sudo service mysql [start|stop]

but passing arguments here doesn't work. Alternativly, if I start it as a daemon process

sudo mysqld --wait_timeout <#> 

How do I then shut it down in a safe way (I'd imagine 'CTRL-C' or `kill -9'ing it would be bad).

System info (if relevant):

mysqld  Ver 5.5.31-0ubuntu0.12.04.1 for debian-linux-gnu on x86_64 ((Ubuntu))
Ubuntu 12.04 LTS 
Community
  • 1
  • 1
Alex
  • 2,000
  • 4
  • 23
  • 41

2 Answers2

3

Instead of putting that option on the command line, you may put the option in /etc/mysql/my.cnf. Just make sure the option is in the section [mysqld]. Please refer to https://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_wait_timeout for the name to be used in option file.

Another way to change the option maybe change the option on a running MySQL server, by executing this SQL:

SET GLOBAL wait_timeout = <value>;
Raymond Tau
  • 3,429
  • 26
  • 28
1

Try increasing max_allowed_packet to something quite large like 32M. I've never understood this well, but I think it could solve your issue.

Cargo23
  • 3,064
  • 16
  • 25