On 04/01/12 16:46, Jim Rippon wrote:
Something like this would do the trick if you aren't worried about encryption or anything like that (I'd suggest you investigate storing the password for this somewhere other than in your script, however):
I would suggest creating a backup user so that you're not needing the root user at all: grant select, lock tables on *.* to backup@localhost identified by 'backup'; then mysqluser=backup mysqlpass=backup
Depending on the type of data, you may prefer to remove the "lock tables" privilege and add "--skip-lock-tables" to the mysqldump command; personally I prefer not to have my backup script lock my tables and would prefer to deal with the consequences of any inconsistent data on restore (which would be minimal with the types of data I do this with).