Mysql DB Full Dump - BackUp - Restore
TERMINAL 1 (sync & lock MyIsam Tables)
-------------------------------------------
mysql -u root -p
>FLUSH TABLES WITH READ LOCK;
Without closing the connection to the client
(I.E. in another terminal window... because it would release the read lock)
issue the command to get a dump of the master:
TERMINAL 2 (do the bkup - InnoDB Tables are sync-ed & locked here - delete old bin-logs)
---------------------------------------------------------------------------------------------
mysqldump -u root -p --single-transaction --routines --flush-logs --master-data=2 --all-databases --delete-master-logs > [abs-path-to/]mysqldump.sql
WAIT TILL FINISHED...
Now you can release the lock (on MyIsam Tables).
To do it perform the following command in the TERM1 mysql client:
TERMINAL 1
----------------
>UNLOCK TABLES;
>QUIT
------------------------------------------------
------------------------------------------------
Restore Data Dump with this console command:
mysql -u root -p < mysqldump.sql
Then restore bin-logs (incremental bkup):
mysqlbinlog bin-log.1 [bin-log.2 ... bin-log.N] | mysql -user root -p
IMPORTANT: Use ALL Bin Logs in the same command!