Home > Database > Mysql Tutorial > Can I Restore a Single MySQL Table from a Full mysqldump?

Can I Restore a Single MySQL Table from a Full mysqldump?

DDD
Release: 2024-12-04 07:04:13
Original
692 people have browsed it

Can I Restore a Single MySQL Table from a Full mysqldump?

Can a Single Table Be Restored from a Full MySQL mysqldump File?

Restoring a particular table from a comprehensive MySQL mysqldump backup containing all tables is feasible.

Solution:

Utilize the "sed" command to extract only the desired table. For instance, given a mysqldump file named "mysql.dump" and a table named "mytable":

$ sed -n -e '/CREATE TABLE.*`mytable`/,/Table structure for table/p' mysql.dump > mytable.dump
Copy after login

This command will create a new file, "mytable.dump," containing everything between CREATE TABLE mytable and the next CREATE TABLE for another table.

Modify "mytable.dump" to include the table structure and data inserts. Subsequently, you can import the restored table using a database tool.

The above is the detailed content of Can I Restore a Single MySQL Table from a Full mysqldump?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template