开发者

Backup all MySQL databases that a mysql user has access to

开发者 https://www.devze.com 2023-01-16 11:46 出处:网络
I need to backup all MySQL databases available to a partiular user and store them databasename_date.sql

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

0

精彩评论

暂无评论...
验证码 换一张
取 消