Manual Recovery

Manual Recovery

If you want to restore all of the server’s data,because some data was inadvertently deleted by an SQL statement, a simple full recovery using the binary logs will only repeat the mistake. For such a situation,
run the mysqlbinlog and redirect results to a text file so that you can edit it before passing the file on to MySQL.To redirect the output from mysqlbinlog, you would enter as follows:

mysqlbinlog /var/log/mysql/bin.464442 > /tmp/mysql_restore.sql

This will create a simple text file in the /tmp directory that you can edit.After you’ve deleted the unwanted SQL statements and saved the restore file, you can then run it as follows:

mysql -u root -pmypwd –socket=/tmp/mysql_restore.sock < /tmp/mysql_restore.sql

The –socket option will temporarily name a different socket file for Unix systems.

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.