Export MySQL Table Structure Guide
The following command can be used in MySQL to export the structure of a specified table:
mysqldump -d -h hostname -u username -p password database_name table_name > table_structure.sql
The parameters are explained as follows:
- -d: Export only the table structure, without including data.
- -h: specify the host name of the database
- -u: specify the database username.
- -p: specify the password for the database.
- Name of the database to be exported:
- table name: the name of the table to be exported
- table_structure.sql: The name of the exported SQL file.
After executing the above command, a file named table_structure.sql will be generated in the current directory, containing the structure information of the specified table.