Home > Database > Mysql Tutorial > How to restore mysql after deletion

How to restore mysql after deletion

下次还敢
Release: 2024-04-14 19:30:27
Original
1168 people have browsed it

Deleted MySQL data recovery method: stop the server (1), back up the data directory (2), log in as super user (3), execute the recovery command in sequence (4), restore the data directory backup (5) , start the server (6).

How to restore mysql after deletion

How to recover deleted MySQL data

Steps to recover deleted data

  1. Stop the MySQL server.
  2. Back up the MySQL data directory.
  3. Start the MySQL server, and log in as super user.
  4. Run the following command to restore data:
<code>mysql -u root -p
USE database_name;
PURGE BINARY LOGS BEFORE 'log_name';
STOP SLAVE;
CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=0;
RESET SLAVE;</code>
Copy after login

Where:

  • database_name is the deleted data database name.
  • log_name is the name of the binary log file that is logged before data is deleted.
  1. Restore the backup of the MySQL data directory.
  2. Start the MySQL server.

Note:

  • This recovery method can only be used if binary logging is enabled.
  • After recovery, all data created after deleting the data will be lost.
  • If this method cannot be used, you can also try to use third-party tools or contact the database administrator for help.

The above is the detailed content of How to restore mysql after deletion. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template