Saturday, March 17, 2012

phpMyAdmin and MySQL — Drop Tables

phpMyAdmin and MySQL — Drop Tables with Common Prefix | DigitalWindFire: A handy tip for my Wordpress experimentation--this is how I delete the Wordpress portion of my database without touching the Drupal installation:


SELECT * FROM (
SELECT CONCAT('DROP TABLE ', GROUP_CONCAT(table_name) , ';')
FROM INFORMATION_SCHEMA.TABLES
WHERE table_name LIKE 'wp_%'
) a INTO @stmt;

PREPARE statement FROM @stmt;
EXECUTE statement;

No comments: