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

How to use full database backup data to restore single table data in MySQL

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

How to use full database backup data to restore single table data in MySQL? Many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can gain something.

Extract the construction table statement

Sed-e'/. / {Htincter mysqldump.sql;}'- e'x _ bank _ create _ TABLE `table name `/! d _ _ q' name (the file name of the backup file)

Sed-e'/. / {Hinto character_set_client documents;}'- e'x SET character_set_client create TABLE `fdc_ document` /! d SET character_set_client q' fdcsqlmysql-2018_11_30-03_00_01.sqlDROP TABLE IF EXISTS `fdc_ document`; / *! 40101 SET @ saved_cs_client = @ @ character_set_client * /; /! 40101 SET character_set_client = utf8 * / CREATE TABLE `fdc_ document` (`id`int (10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'document ID', `uid` int (10) unsigned NOT NULL DEFAULT' 0' COMMENT 'user ID', `name` char (40) NOT NULL DEFAULT' 'COMMENT' ID',. `entrust_ rule` tinyint (3) unsigned NOT NULL DEFAULT'0' COMMENT 'broker click whether to sign an entrustment agreement with the user: 1 0: no', `audit` tinyint (3) NOT NULL DEFAULT'0' COMMENT': 0: unaudited; 1: picture audited; 2: description audited 3: pictures and descriptions have been audited', PRIMARY KEY (`id`), KEY `idx_area_ house` (`partition`, `category_ id`, `status`, `is_ off`) USING BTREE, KEY `idx_model_ house` (`model_ id`, `status`, `is_ off`) USING BTREE, KEY `idx_community_ house` (`community_ id`, `estate`, `status`, `is_ off`) USING BTREE, KEY `idx_uid_ house` (`uid`, `model_ id`, `is_ off`) USING BTREE, KEY `idx_pid_ house` (`id`, `pid`, `status`, `is_ off`) USING BTREE KEY `is_ video` (`is_ video`) USING BTREE) ENGINE=InnoDB AUTO_INCREMENT=211138 DEFAULT CHARSET=utf8 / * 40101 SET character_set_client = @ saved_cs_client * /

Extract table data

Grep 'INSERT INTO table name' mysqldump.sql (filename of backup file) > table_data.sql

Grep 'INSERT INTOfdc_document' fdcsqlmysql-2018_11_30-03_00_01.sql > document.sql should be executed here

After execution, you will get the file document.sql, which is the separate table file you need, so you can recover the table data normally.

Build a database and a table

Create the database first, and then create the table fdc_document according to the above SQL statement

Import table data

MySQL [document] > souce / data/backup/mysql/document.sql is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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