Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysqldump: Got errno 32 on write

I used this script for years on my VPS. And it's still working.

DBLIST=`mysql -uroot -pROOT_PASSWORD -ANe"SELECT GROUP_CONCAT(schema_name) FROM information_schema.schemata WHERE schema_name NOT IN ('information_schema','performance_schema')" | sed 's/,/ /g'`
MYSQLDUMP_OPTIONS="-uroot -pROOT_PASSWORD --single-transaction --routines --triggers"
BACKUP_DEST="/home/backup/db/"
for DB in `echo "${DBLIST}"`
do
    mysqldump ${MYSQLDUMP_OPTIONS} ${DB} | gzip > ${BACKUP_DEST}/${DB}.sql.gz &
done
wait
tar -czvf /home/backup/db2/`date +\%G-\%m-\%d`_db.tar.gz ${BACKUP_DEST}

Now I'm moving to another hosting. I 'm trying to use the same script (of course I changed ROOT_PASSWORD with the new credentials) but I don't know why I get this:

mysqldump: Got errno 32 on write
mysqldump: Got errno 32 on write
mysqldump: Got errno 32 on write
mysqldump: Got errno 32 on write
mysqldump: Got errno 32 on write
mysqldump: Got errno 32 on write
mysqldump: Got errno 32 on write
mysqldump: Got errno 32 on write
mysqldump: Got errno 32 on write
mysqldump: Got errno 32 on write
mysqldump: Got errno 32 on write
mysqldump: Got errno 32 on write
mysqldump: Got errno 32 on write
like image 356
MultiformeIngegno Avatar asked Mar 09 '14 21:03

MultiformeIngegno


2 Answers

20:47:59 0 ~] $ perror 32
OS error code  32:  Broken pipe

So errno 32 is "broken pipe". You're piping the mysqldump output to gzip , so this means gzip terminated prior to mysqldump finished. Could e.g. be because your disk is full, or gzip surpassed any max CPU time/usage your host has in place.

like image 166
nos Avatar answered Nov 18 '22 15:11

nos


I had the same problem due to a couple of typos.

  1. I typed the name of the db user incorrectly. I had "db_user_1" when he was really "db_user1".

  2. After the pipe I forgot the > in gzip > myfile.tar.gz.

But I recommend you upgrade to MySQL 5.6+ asap, so you can stop exposing database passwords other users.

Check out this answer on StackOverflow.

like image 15
Buttle Butkus Avatar answered Nov 18 '22 16:11

Buttle Butkus