Mysql – Setting automatic backups of MySQL database including table lock etc – MySQL Workbench

backupMySQL

We've got a Virtual Server with full ssh and root access running LAMP on Ubuntu Server.

I've got a small computer in the office running ubuntu that isn't being used for anything.
I thought I should use it to make and store (a copy of) our MySQL database backups. However, how do I go about backing up our databases?

MySQL Workbench locks tables to avoid errors, amongst a host of other features, but does not have any planned automatic backup bits planned. MySQL Dumper doesn't specify that they can keep the database consistent.
Source for information from this paragraph:

I don't see the point of running a php script on my server and emailing the backups when I have SSH access. Since backups are so important, I figure there must be a standard (or awesome) way of doing it I haven't found yet!

So how do I go about backing up our data? And, preferably, our users, config, etc too!

Best Answer

If you have MySQL installed on the Ubuntu machine, you can do the following:

Suppose IP of Virtual is 10.1.2.30

You can the following on the Ubuntu machine

BACKUP_FILE=/root/MySQLData.sql
MYSQL_HOST=10.1.2.30
MYSQL_USER=whateverusername
MYSQL_PASS=whateverpassword
MYSQL_CONN="-h${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_PASS}"
mysqldump ${MYSQL_CONN} --all-databases > ${BACKUP_FILE}

You could crontab this on the Ubuntu machine as well

If you are looking for consistent mysqldumps, you could

Give it a Try !!!