Exporting a Database Schema in MySQL

File this under “Useful things to remember”.

The following bit of command line magic will export the schema of your database.

mysqldump --no-data --tables -u YOUR_USER_NAME -p DATABASE_YOU_WANT_SCRIPTED >> FILENAME.sql


An example looks like this:

mysqldump --no-data --tables -u larry -p contacts >> contacts.sql
If you want the data as well, omit the “—no-data” portion.

If you enjoyed what you've read here today, please consider subscribing to my RSS Feed

blog comments powered by Disqus
,