# How to export only the schema of one, multiple or all databases
By using the flag --no-data
, mysqldump will export only the schema of the given databases, without any data. This is useful in case you need to create a new database using the same schema but without any data.
# Export the schema of a single database
To export only the schema of a database named my_app
, execute:
mysqldump my_app --no-data > my_schema.sql
# Export the schema of multiple databases
To export only the schema of two databases named my_app1
and my_app2
, you can use the following command:
mysqldump --databases my_app1 my_app2 --no-data > my_schema.sql
# Export the schema of all databases
To export the schema of all the databases, execute:
mysqldump --all-databases --no-data > my_schema.sql