Uncracking MySQL Backup and Data Recovery




Data backups are very easy to understand. However, the implementation and storage parts come with a complicated edge for every web hosting company. A number of third party backup mechanisms are known and being discovered today. in addition the most popular among them remains the MySQL tool.

The MySQL in database server can get ruined in a countless ways no matter how great a piece of software and how skilled the users may be. Getting back the MySQL is far from a complicated thing if you are having reliable backups in place.

InnoDB is well known as the major storage engine for MySQL. InnoDB comes with an automatic encased recovery system that roles quite seamlessly. At any point if the database hosting is snapped, InnoDB comes to rescue and attempts fixing issue by running the log file from the obtainable last timestamp. In almost every example the InnoDB meets with success. uncommon conditions like operating system failures or strength crashes offer examples where boring data recovery is done by InnoDB. however if and if there is failure of InnoDB in giving automatic repair solution, the complete database gets paralyzed.

No less meaningful for any hosting organization is the fact that regular and timely backups of your database should be scheduled. The mysqldump utility for conducting backups of data as a snapshot with reference to some point of time is a highly important tool. The administrators follow the below command to produce a “dump file” of MySQL database:

shell> mysqldump –single-transaction –flush-logs –master data=2

–all-databases > dump.sql

You can go ahead and name the output file in any way you please – in the current scenario it is titled dump.sql. This dump.sql file consists of the data, structures of all databases & tables thoroughly backed up into an SQL text file, called the dump.sql.

In the aforementioned command, ‘-single-transaction component is mainly for InnoDB tables. It executes an online backup that allows no locks on tables.

It is crucial that you duly save incremental changes so as to be able to find incremental backups- very crucial for web hosting companies. By using binary logs, this step can be easily achieved. It is advisable to start MySQL always with the -log-bin option to permit that binary log. In the mysqldump command mentioned here above you can see the ‘-flush-logs’ option using which administrators can flush out various logs. A proper flushing schedule of such logs can be kept to ensure it is done on incremental basis during dump backups to sustain complete data changes initiated since the time of initial backups.

Imagine you have a case where your database goes by a devastating crash. Restoring operations become simplified if regular backups are organized along with binary logs. In this case it is advised to take restore till the point of last overall backup by the below command:

shell> mysql < dump.sql

Now you get data restored to the point it was when you did last mysqldump backup. For restoring different changes that may have accrued since then, always take incremental backups from binary log files that you find listed in the data directory of MySQL server (in this example, logfilename-bin.000001 and logfilename-bin.000002).

shell> mysqlbinlog logfilename-bin.000001 logfilename-bin.000002 mysql




leave your comment

Top