0

I did the installation of a theme in Magento through the quick start of the theme, however, duplicate tables were created in the db. So the tables have no prefix and prefix with their duplication.

The question is, how do I delete all tables with the prefix?

the prefix is​​: #_

1

2 Answers 2

0

Use a program of your choice, I prefer Sequel pro and mark the tables and delete them. Check "Force delete", so they are gone after this.

5
  • Yes, but I want some script to do this, there are a lot of tables
    – luiza
    Oct 20, 2014 at 23:34
  • No there are only around 300 and you can just mark them all, because they are all together? Oct 21, 2014 at 11:51
  • they are all together, prefix, non-prefix, and other prefix.
    – luiza
    Oct 21, 2014 at 15:53
  • I don't understand. At least phpmyadmin and sequelPro order the tables by name, you can even write a query which gives you all the table names with the prefix, then take this list and run it through a PHP script which generates all the DROP TABLE statements. this is a lot faster than this discussion here. Maybe I don't understand the problem. Oct 21, 2014 at 16:03
  • hey, @MageWH solved my question. My database created 3 types of the same tables, and I dont know why.
    – luiza
    Oct 22, 2014 at 11:43
0

@MageWH send the solve question here:

https://stackoverflow.com/questions/1589278/sql-deleting-tables-with-prefix

For someone with the same question, here is the script:

SELECT CONCAT( 'DROP TABLE ', GROUP_CONCAT(table_name) , ';' ) 
    AS statement FROM information_schema.tables 
    WHERE table_schema = 'database_name' AND table_name LIKE 'myprefix_%';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.