I've found some solution on mysql website, how to delete multiple tables according to some condition, you will need it when you will want delete specific tables from your DB.
Just replace dbname and table prefix/suffix in following line:
CALL drop_tables_like('prefix_%', 'dbase')$$
DELIMITER $$
CREATE PROCEDURE drop_tables_like(pattern VARCHAR(255), db VARCHAR(255))
BEGIN
SELECT @str_sql:=CONCAT('drop table ', GROUP_CONCAT(table_name))
FROM information_schema.tables
WHERE table_schema=db AND table_name LIKE pattern;
PREPARE stmt FROM @str_sql;
EXECUTE stmt;
DROP PREPARE stmt;
END$$
CALL drop_tables_like('prefix_%', 'dbase')$$
DROP PROCEDURE IF EXISTS drop_tables_like$$
DELIMITER ;
Comments (0)
RSS Collapse / ExpandOnly registered and authorized users can leave comments. Login or Register