recently i was wondering how could i just use drop to drop multiple tables with a wildcard..?? googled it found out that u cant do drop tables with wildcard so now what first what i did was
to look for tables with wild card
show tables like ‘phpbb_%’;
Got a reply with all the tables of phpBB
then
DROP TABLE phpbb_auth_access,
phpbb_banlist,
phpbb_categories,
phpbb_config,
phpbb_confirm,
phpbb_disallow,
phpbb_forum_prune,
phpbb_forums,
phpbb_groups,
phpbb_posts,
phpbb_posts_text,
phpbb_privmsgs,
phpbb_privmsgs_text,
phpbb_ranks,
phpbb_search_results,
phpbb_search_wordlist,
phpbb_search_wordmatch,
phpbb_sessions,
phpbb_sessions_keys,
phpbb_smilies,
phpbb_themes,
phpbb_themes_name,
phpbb_topics,
phpbb_topics_watch,
phpbb_user_group,
phpbb_users,
phpbb_vote_desc,
phpbb_vote_results,
phpbb_vote_voters,
phpbb_words;
all done
Now if you are lucky enough to have a ssh access on the server then you can do some tweaking with the mysql.
Let see how its done!
type this on your bash
$ mysql -u webmaster -p -e “show tables like ‘stup_%’” web > result.txt
Replace webmaster with the database user and web with the database name
you will have a file named result.txt
now
gawk -F
‘{print “”$1″,” }’ result.txt > alltables.sql
you will then have a file name alltables.sql
next open up alltables.sql and replace first line with
DROP TABLE
and the last line should end with ;
then on bash
mysql -u webmaster -p web < alltables.sql
and all the tables are gone
steve!