MySQL Forums
Forum List  »  Newbie

Re: BASH COMMAND TO SEARCH AND DELETE ALL EMPTY TABLES IN A DATABASE
Posted by: Rick James
Date: November 29, 2015 12:28PM

See if this gives you the correct list:

mysql -e "SELECT CONCAT('DROP TABLE ', table_schema, '.', table_name) FROM information_schema.tables WHERE table_schema NOT IN ('mysql', 'information_schema', 'performance_schema') AND table_rows = 0"

If it does, then redirect that to a file and send that to mysql.

Options: ReplyQuote


Subject
Written By
Posted
Re: BASH COMMAND TO SEARCH AND DELETE ALL EMPTY TABLES IN A DATABASE
November 29, 2015 12:28PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.