How can mysql mysqldump export only table structure or only data?
This article mainly introduces "mysql mysqldump how to export only table structure or only export data". In daily operation, I believe many people have doubts about how mysql mysqldump can only export table structure or only export data. Xiaobian consulted all kinds of information and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for everyone to answer the question of "how to achieve mysql mysqldump to export only table structure or only export data". Next, please follow the editor to study!
Mysql mysqldump only exports table structure, not data server
The copy code is as follows:
Mysqldump-- opt-d database name-u root-p > xxx.sql
Backup database
The code is as follows:
# mysqldump database name > database backup name # mysqldump-A-u user name-p password database name > database backup name # mysqldump-d-A-- add-drop-table-uroot-p > xxx.sql
1. Export structure does not export data
The code is as follows:
Mysqldump-- opt-d database name-u root-p > xxx.sql
two。 Export data does not export structure
The code is as follows:
Mysqldump-t database name-uroot-p > xxx.sql
3. Export data and table structure
The code is as follows:
Mysqldump database name-uroot-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
Import data:
Because mysqldump exports complete SQL statements, it is easy to import data with a mysql client:
The code is as follows:
# mysql database name