Backup all MySQL databases that a mysql user has access to
I need to backup all MySQL databases available to a partiular user and store them databasename_date.sql
Is there any way to开发者_开发百科 use mysqldump to dump all databases instead of telling it each database name it needs to backup?
Thanks
You can try for linux
date=
date -I
; mysqldump -u yourusername -p yourpassword --all-databases > /home/LOGIN/backups/xbackup_$date.sql; gzip /home/LOGIN/backups/xbackup_$date.sql
More detailed explaination is given at
http://www.skyminds.net/2004/05/29/backup-all-your-mysql-databases-with-one-line-of-cron/
I ended up using AutoMySql Backup, this is a small script which backsup everything the user has access to and rotates it over a 5 day period.
You can try --all-databases
switch
精彩评论