Implementation of restoring data by directly copying files in the data directory in mysql

Implementation of restoring data by directly copying files in the data directory in mysql

mysql copies the files in the data directory to restore the data

Background: MySQL crashed and could not be started. I decided to rebuild the environment, but I forgot to back up the database test data. The MySQL data directory survived.

operate:

1. Copy the folder of the test database (including .frm .ibd and other files)

2. Restart MySQL

When viewing a table in the database through Navicat, the result shows "Table 'xxx' does not exist"

3. After searching on Google and Baidu, I found the innodb table

Directly copying the file is not usable, and it will prompt that the table does not exist. When copying, the ibdata1 file in the data directory should be copied together, and the ib_logfile0, ib_logfile1 and other files should be deleted.

mysql migrates the database by copying data files

1. Shut down the service

Run cmd as an administrator and execute the following command:

net stop mysql

2. Copy data files

Copy the database file of the data file (no need to copy mysql, performance_schema, sys), and be sure to copy the ibdata1 file

這里寫圖片描述

3. Import files

Put the copied file into the data file of the destination database

The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Springboot uses spring-data-jpa to operate MySQL database
  • DataGrip connects to Mysql and creates a database
  • Springboot configures mysql database spring.datasource.url error solution
  • MySQL database Load Data multiple uses
  • Python pymysql link database query results converted to Dataframe instance
  • MySQL database data basic operations

<<:  Search optimization knowledge to pay attention to in web design

>>:  Three ways to achieve background blur in CSS3 (summary)

Recommend

XHTML Web Page Tutorial

<br />This article is mainly to let beginner...

How to install theano and keras on ubuntu system

Note: The system is Ubuntu 14.04LTS, a 32-bit ope...

How to install Jenkins using Docker

Table of contents 1. Pull the image 2. Create a l...

Shell script nginx automation script

This script can satisfy the operations of startin...

CentOS 6 uses Docker to deploy redis master-slave database operation example

This article describes how to use docker to deplo...

How to Apply for Web Design Jobs

<br />Hello everyone! It’s my honor to chat ...

Solve the problem of MySql8.0 checking transaction isolation level error

Table of contents MySql8.0 View transaction isola...

JavaScript to achieve mouse tailing effect

Mouse effects require the use of setTimeout to ge...

Summary of basic operations for MySQL beginners

Library Operations Query 1.SHOW DATABASE; ----Que...

How to support full Unicode in MySQL/MariaDB

Table of contents Introduction to utf8mb4 UTF8 by...

How to calculate the value of ken_len in MySQL query plan

The meaning of key_len In MySQL, you can use expl...

What to do if the container started by docker run hangs and loses data

Scenario Description In a certain system, the fun...

In-depth reading and practice records of conditional types in TypeScript

Table of contents Using conditional types in gene...