Thursday, 8 November 2018

MySql export schema without data

I'm using a MySql database with a PHP program, now I want to give the program to somebody else.
How to export the MySql database structure without the data in it, just the structure?

 Answers


You can do with the --no-data option with mysqldump command
mysqldump -u root -p --no-data dbname > schema.sql



you can also extract an individual table with the --no-data option
mysqldump -u user -h localhost --no-data -p database tablename > table.sql






Dumping without using output.
mysqldump --no-data <database name> --result-file=schema.sql



You can take using the following method
mysqldump -d <database name> > <filename.sql> // -d : without data
Hope it will helps you

0 comments:

Post a Comment