mysqldump all databases into individual files

2009 August 10
tags: Databases
by Josh Hand

I came across this today, Backup all MySQL Databases to individual files. I had been looking for a nice way to do this for quite a while and I think this is simplest and easiest way I've come across to date.

I used their second solution:

for I in `echo "show databases;" | mysql | grep -v Database`; do    mysqldump $I > "$I.sql"; done

But had to add in authentication details:

for I in `echo "show databases;" | mysql -u myuser --password="password" | grep -v Database`; do mysqldump -u myuser --password="password" $I > "$I.sql"; done

No Responses leave one →

Leave a Reply