July 30, 2009

Deleting all tables in a mysql database

Turned out there is no command like "trunk database " but unix piping could be a savior.

Warning: Somehow my putty session crashes after running the command mentioned below and i've to restart the session. Just in case you know a better way to do this, please do share in the comments. Thanks!

mysqldump -h <dbhost> -u <dbuser> -p --add-drop-table --no-data <dbname> | grep ^DROP | mysql -h <dbhost> -u <dbuser> -p <dbname>

No comments: