Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySql export schema without data

Tags:

sql

mysql

I'm using a MySql database with a Java 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?

like image 797
Darth Blue Ray Avatar asked May 30 '11 11:05

Darth Blue Ray


People also ask

How do I create a schema in MySQL?

Steps to create a schema in MySQLOpen the MySQL Workbench. Click the Create Schema option. Provide a schema name. Click apply to create the MySQL scheme.


2 Answers

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

mysqldump -h yourhostnameorIP -u root -p --no-data dbname > schema.sql 
like image 196
Daric Avatar answered Oct 06 '22 11:10

Daric


Yes, you can use mysqldump with the --no-data option:

mysqldump -u user -h localhost --no-data -p database > database.sql 
like image 22
onteria_ Avatar answered Oct 06 '22 13:10

onteria_