Export mysql Schema with or without data

In this tutorial learn how to export mysql Schema with or without data.

1. with data



You can do with  mysqldump command 

mysqldump -u root -p dbname > schema.sql 

you can also extract schema with Table name with  --no-data option 

mysqldump -u user -h localhost -p database tablename > table.sql 
2. Without Data

You can do with the --no-data option with mysqldump command

mysqldump -u root -p --no-data dbname > schema.sql 

you can also extract schema with Table name with  --no-data option 

mysqldump -u user -h localhost --no-data -p database tablename > table.sql 
 

This will produce a .sql file that you can load onto a mysql server to create a new fresh database.


No comments:

Post a Comment

how to call ssh from vs code

 To call SSH from VS Code, you can use the built-in Remote Development extension. This extension allows you to open a remote folder or works...