jrobinsonc
10/17/2016 - 3:28 AM

MYSQL - Execute query on all tables.

MYSQL - Execute query on all tables.

read DBUSER
read DBPASS
read DBNAME

# In this case, we are deleting all tables
mysql -u $DBUSER -p$DBPASS -Nse "show tables" $DBNAME | while read table; do mysql -u $DBUSER -p$DBPASS -e "drop table $table" $DBNAME; done