This post i will show you how to dump just the schema of the a mysql database , for a single table, or for several tables.
Database structure for all tables with no data to a file
[root@manivel]# mysqldump -d -u root -p database_name > database_schema.sql
-d ---> -d flag to denote that no data should be included in the output.
[root@devops devops]# mysqldump --no-data -u root -p database_name > database_schema.sql
--no-data --> to denote that no data should be included in the output.
Database structure for one table with no data to a file
[root@manivel]# mysqldump -d -u root -p database_name table_name> table_schema.sql
Database structure for several table with no data to a file
[root@manivel]# mysqldump -d -u root -p database_name table_name_1 table_name_2 table_name_3 > multiple_table_schema.sql
Database structure for all tables with no data to a file
[root@manivel]# mysqldump -d -u root -p database_name > database_schema.sql
-d ---> -d flag to denote that no data should be included in the output.
[root@devops devops]# mysqldump --no-data -u root -p database_name > database_schema.sql
--no-data --> to denote that no data should be included in the output.
Database structure for one table with no data to a file
[root@manivel]# mysqldump -d -u root -p database_name table_name> table_schema.sql
Database structure for several table with no data to a file
[root@manivel]# mysqldump -d -u root -p database_name table_name_1 table_name_2 table_name_3 > multiple_table_schema.sql
No comments:
Post a Comment