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 mysql exports only the table structure

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

Share

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

Today Xiaobian to share with you how mysql only export table structure related knowledge points, detailed content, clear logic, I believe most people still know too much about this knowledge, so share this article for everyone to refer to, I hope you have some gains after reading this article, let's learn about it together.

Methods: 1. Using "mysqldump --opt -d database name-u root -p >... "statement export database table structure;2, using"mysqldump -uroot -p -B database name--table table name>... "Statement exports the structure of the specified table.

Operating environment of this tutorial: Windows 10 system, mysql version 8.0.22, Dell G3 computer.

How does mysql export table structure only?

mysql mysqldump exports only table structures, not data

1. Export structure Do not export data

The code is as follows:

mysqldump --opt -d database name-u root -p > xxx.sql

2. Export data without exporting structure

The code is as follows:

mysqldump -t database name-uroot -p > xxx.sql

3. Export data and table structures

The code is as follows:

database name-urot-p > xxx.sql

4. Export the structure of a specific table

The code is as follows:

mysqldump -uroot -p -B database name--table table name> xxx.sql

Extended knowledge:

mysqldump is MySQL's logical backup tool.

Its backup principle is to connect to MySQL database through protocol, query the data that needs to be backed up, and convert the queried data into corresponding insert statements. When we need to restore these data, as long as these insert statements are executed, the corresponding data can be restored.

backup command

command format

mysqldump [options] database name [table name] > script name

or

mysqldump [options] --database name [options table name] > script name

or

mysqldump [options] --all-databases [options] > Script name above is "mysql how to export only table structure" All the contents of this article, thank you for reading! I believe everyone has a great harvest after reading this article. Xiaobian will update different knowledge for everyone every day. If you want to learn more knowledge, please pay attention to the industry information channel.

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