Solution to accidental deletion of mysql data
This article mainly introduces the mysql data accidentally deleted solution, with a certain reference value, friends can refer to the need. I hope you all have a lot to gain after reading this article. Let's take a look at it together.
MySQL data accidental deletion solution: first in the database file stored in the data directory to find the [mysql-bin.00000x] file; and then exported to txt format; finally enter the relevant statements to restore the data.
Solutions to accidental deletion of mysql data:
1. First confirm whether mysql has enabled bin logging, that is, look at log-bin=mysql-bin in mysql.ini (my.cnf), you can customize a directory and prefix name, such as/data/log/mylog.
2, and then in the database file stored in the data directory you can see mysql-bin. 0000x such a file, this is the binary log, can be exported into txt format, which is actually a variety of database operations sql statements.
3. Export txt file:
e:\wamp\bin\mysql\mysql5.6.12\bin>mysqlbinlog--database=testdatabasee:\wamp\bin\mysql\mysql5.6.12\data\mysql-bin.000312>c:\\test1.txt
This is Windows export, Linux is similar.
database= database name
restore from the earliest logs
Linux can be very convenient mysql-bin.000*
You can add parameters start time and end time, which is the time you execute that sql statement.
start-datetime="2014-12-0411:25:56"--stop-datetime="2014-12-0413:23:50"
4. Recovery of data:
e:\wamp\bin\mysql\mysql5.6.12\bin>mysqlbinlog--database=yundongchaoe:\wamp\bin\mysql\mysql5.6.12\data\mysql-bin.000179| mysql-uroot-p Thank you for reading this article carefully. I hope that Xiaobian will share the solution content of mysql data accidentally deleted to help everyone. At the same time, I hope that everyone will support you a lot. Pay attention to the industry information channel and find out if you encounter problems. Detailed solutions are waiting for you to learn!