Explore Courses Blog Tutorials Interview Questions
0 votes
in SQL by (20.3k points)

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?

1 Answer

0 votes
by (40.7k points)

Yes, you can do that by using --no-data option with mysqldump command-line tool of MYSQL

 To get the schema, a mysqldump command is used: 

  • A mysqldump command-line tool of MYSQL is used to create dumps (or backup copies) of databases including the schema or structure and the data itself as well. Many command-line flags are there which are used to get the structure or the data instead of everything. 

  • With the help of no data, you can dump the database structure for all the tables in this way

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

Here, the -u flag indicates the username, whereas the -p flag is used for the password that will be supplied. Once, you press the <enter> tab you will be prompted for the password.

Alternatively, the password can also be supplied on the command line, but there should not be any spaces between the -p flag and the password. 

Related questions

0 votes
1 answer
asked Dec 22, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.5k answers


108k users

Browse Categories