Reputation: 155
I recently started getting these messages when I run a script that has been working without any issues for years.
The command seems to do its job, and the resulting file seems complete, which just adds to the mystery.
This is on a VPS, which has limited CPU and memory, so presumably I'm hitting one of those limits, but it would be helpful to know for sure.
So I looked for a reference about mysqldump
error codes, and found nothing. There are similar questions on StackOverflow, but all for different errno
numbers.
Upvotes: 1
Views: 1383
Reputation: 20881
Use this parameter to prevent memory leaks and overflows: --max_allowed_packet=2M
. The default value is 16M
, and the max allowed value for this is 64M
. If this fails, try lower values.
nice mysqldump
-u MYUSERNAME
-pMYPASSWORD
--max_allowed_packet=2M
-h DATABASEHOST
--default-character-set=latin1
--skip-set-charset
--no-tablespaces
-N --routines
--quick
--skip-triggers
DATABASENAME > OUTPUTFILE
nice
: Run this command with priority.max_allowed_packet
: This solves the problem.quick
: This is another attempt to reduce memory problems by doing chunking, but this will solve errno 6
(out of memory on mysql processing), and presumably not errno 12
(out of memory in linux process-handling), but I still do it to help with memory. (Yes, quick
was a bad name for this parameter.)You can always find out what an exit code means by using errno()
. Exit code 12 is for...
ENOMEM
— 12 : Cannot allocate memory
To see what an error code is, simply run this command in linux: errno 12
, or whatever the number is. To see all of the errors possible, run errno -ls
.
Basically, your host is not allowing you the memory to do the backup command.
Upvotes: 1