0

I have Mysql database. I want to take only the skeleton of my database i.e.I want only the scripts to create Database and tables. Not the entire database back up which comes with database structure and data.

Please Help me. I Use Mysql 5.0

3 Answers3

3
mysqldump --all-databases --no-data
Barmar
  • 741,623
  • 53
  • 500
  • 612
0

From MySql export schema without data:

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

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

Jim helpfully contributes:

consider using the --single-transaction option if you don't want or can't do table locks.

Community
  • 1
  • 1
ta.speot.is
  • 26,914
  • 8
  • 68
  • 96
0

Here is my summary about mysql dumping commands, hope to help you

backup the entire database

mysqldump -uroot -p db_name > /home/bob/my.sql

backup single table

mysqldump -uroot -p db_name table_name > /home/bob/table.sql

backup only database structure,

mysqldump -uroot -p db_name -d > /home/bob/structure.sql

backup only database data

mysqldump -uroot -p db_name -t > /home/bob/data.sql


How to execute the exported sql file? See the following

mysql -uroot -p db_name < /home/bob/my.sql

another way, Log into mysql, then

mysql> use db_name;

mysql> source /home/bob/my.sql;

Community
  • 1
  • 1
Hunter Zhao
  • 4,589
  • 2
  • 25
  • 39