Skip to content

Instantly share code, notes, and snippets.

@onigra
Created February 16, 2013 08:29
Show Gist options
  • Save onigra/4966081 to your computer and use it in GitHub Desktop.
Save onigra/4966081 to your computer and use it in GitHub Desktop.
mysqlのスキーマにある各テーブルに対してまとめてごにょごにょするワンライナー

例:データベース名"database_name"にある全てのテーブルにtruncateするワンライナー

for x in `mysql -N -ppassword database_name -e "show tables;"`; do echo "truncate table ${x} ;" | mysql -N -ppassword database_name ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment