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 restore a specified library in mysqldump complete

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

Share

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

In this issue, the editor will bring you about how to restore the designated library in the mysqldump complete. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

There are many ways to recover the specified data from a complete data. you can extract the data database name and table name from the complete data file by special methods, and you can also restore the specified data by a fully specified library name. this method is simple and fast, this method will restore unwanted libraries, but will not restore data.

The process is as follows:

1. Check the database before it is backed up.

MariaDB [(none)] > show databases

+-+

| | Database |

+-+

| | bb |

| | cc |

| | dd |

| | grafana |

| | information_schema |

| | mysql |

| | performance_schema |

| | test |

+-+

MariaDB [(none)] > use grafana

MariaDB [grafana] > show tables

+-+

| | Tables_in_grafana |

+-+

| | api_key |

| | dashboard |

| | dashboard_snapshot |

| | dashboard_tag |

| | data_source |

| | migration_log |

| | org |

| | org_user |

| | star |

| | user |

+-+

10 rows in set (0.00 sec)

MariaDB [test] > select * from aa

+-+ +

| | id | s_num |

+-+ +

| | 1 | 1 |

| | 2 | 2 |

| | 3 | 33331 | |

| | 4 | 33334 |

+-+ +

4 rows in set (0.00 sec)

2. The data mysqldump method of fully preparing an instance

/ usr/local/mysql/bin/mysqldump-S / tmp/mysql3306.sock-p-- all-databases > aa.sql

3. Delete the business library:

Drop database xxxx

4. Restore the specified library. When restoring the specified library, you need to add the restored library to the library, otherwise you will be prompted ERROR 1049 (42000): Unknown database 'test'.

MariaDB [(none)] > create database test

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)] > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | test |

+-+

4 rows in set (0.00 sec)

5. Restore the specified library

/ usr/local/mysql/bin/mysql-S / tmp/mysql3306.sock-p-- one-database test

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

Wechat

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

12
Report