Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Solution to accidental deletion of mysql data

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report