Skip to content

Instantly share code, notes, and snippets.

@meysampg
Created December 30, 2023 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meysampg/1b08f70b97cc2a25cd5f066a2482cc8f to your computer and use it in GitHub Desktop.
Save meysampg/1b08f70b97cc2a25cd5f066a2482cc8f to your computer and use it in GitHub Desktop.
drop all tables of a MySQL database without droping the database
mysqldump -h $DB_HOST -u $DB_USERNAME --password=$DB_PASSWORD --add-drop-table --no-data $DB_DATABASE | grep -e '^DROP \| FOREIGN_KEY_CHECKS' | mysql -h $DB_HOST -u $DB_USERNAME --password=$DB_PASSWORD $DB_DATABASE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment