How can I get a dump of all tables DDL?
Loading
How can I get a dump of all tables DDL?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rijwan AnsariPosted Nov 20, 2021, 2:17 PM
Vinitha TPosted Nov 20, 2021, 12:23 PM
mysqldump command line tool is used to dump all tables in databases managed by SQL and migrats the data to another server.
To dump the table structure for all tables in database:
mysqldump -d -u username -ppassword mydatabase > mydatabase_dump.sql
-d -> not to include data in the dump
-u -> username
-p -> password
mydatabase_dump.sql -> dumping the structure to a file.
There should be no space between -p and password
To dump a single table from your database.
mysqldump --no-data -u username -ppassword mydatabase tablename
--no-data can be used instead of -d
To dump a multiple table from your database.
mysqldump -d -u username -ppassword mydatabase tablename1 tablename2 tablename3
To create same table in another database:
mysql -u username -ppassword newdatabase < mydatabase_dump.sql
Riddhi ValechaPosted Sep 17, 2021, 4:10 PM
Rajanikant HawaldarPosted Sep 17, 2021, 1:50 PM
Pankajkumar PatelPosted Sep 16, 2021, 10:09 AM
Hi Dhawan,
You can "get a dump of all tables DDL" using the mysqldump command line utility:
The -d option means "without data".
For more detail you can refer below article:
Hope, this will help you!