Backup MySQL schema only
Question:
How to backup MySQL schema only? Answer:
mysqldump -u testuser -p --no-data testdb > /tmp/testdb_schema.sql
mysqldump -u [MYSQL_USER] -p --no-data [DB_NAME] > [OUTPUT_FILE]
Description:
Using the --no-data
option with mysqldump
it does not write any table row information (that is, do not dump table contents). This is useful if you want to dump only the CREATE TABLE
statement for the table (for example, to create an empty copy of the table by loading the dump file).
Reference:
mysqldump no-data reference
Share "How to backup MySQL schema only?"
Related snippets:
- Import an SQL file using the command line in MySQL
- Backup only certain rows from MySQL database
- Create INSERT statement for each record with mysqldump
- Backup MySQL database without locking tables
- Backup MySQL data only
- Skip tables in MySQL backup
- Backup only selected tables in MySQL
- Backup MySQL schema only
- Backup MySQL database
Tags:
backup mysql schema, db schema only, export mysql schema Technical term:
Backup MySQL schema only