How to generate DDL for all tables in a database in MySQL

You can do it using the mysqldump command line utility:

mysqldump -d -u <username> -p -h <hostname> <dbname>

The -d option means “without data”.

Leave a Comment