• Services
    • Website Design & Development
    • E-Commerce Shopping Cart Development
    • Website Management
    • Web app & website integration
    • School Website Design
    • Competition Website Design
  • Portfolio
  • Testimonials
  • Contact
  • Blog
  • 01298 816080
  • Menu Menu
You are here: Home1 / Code Snippets2 / MySql3 / Magento Delete All Tables Prefixed With ‘wp_’

Magento Delete All Tables Prefixed With ‘wp_’

Code Snippets, Magento, MySql

Ever installed Magento using a one click installer and forgot to remove the “wp_” prefix ?

Simple to remove your tables ? Nope ! pesky Foreign Key Constraints !

Try this code in your favourite MySql program. Please note running the resulting SQL code this will immediately delete all of your databases prefixed with “wp_” so if you are not sure back up !

Use at your own risk.!

SELECT CONCAT( 'DROP TABLE ', GROUP_CONCAT(table_name) , ';' ) 
    AS statement FROM information_schema.tables 
    WHERE table_name LIKE 'mg_%';

Copy and paste the resultant code into your favourite MySQL GUI (Im a big fan of Navicat ) adding the below to the begining:

SET FOREIGN_KEY_CHECKS=0;

Run the code and thats it !

Dont want to delete all your tables just rename them ?

What about rename all prefixed tables from ‘mg_tablename’ to ‘tablename’ ?

SELECT  concat ('rename table ',table_name,' to ',REPLACE(table_name,'mg_',''),';')
FROM information_schema.tables
WHERE table_name like 'mg_%'
  and table_schema='your_database_name'

Again copy and paste the resultant code into your favourite MySQL GUI adding this code to the begining:

SET FOREIGN_KEY_CHECKS=0;

Warning running any resulting code could ruin your day proceed with caution.

July 23, 2014/by Martin Toner Web Designer Developer
Share this entry
  • Share on Facebook
  • Share on Twitter
  • Share on WhatsApp
  • Share on Pinterest
  • Share on LinkedIn
  • Share on Tumblr
  • Share on Vk
  • Share on Reddit
  • Share by Mail
https://sk23.co.uk/wp-content/uploads/2014/07/logo.jpg 200 200 Martin Toner Web Designer Developer https://sk23.co.uk/wp-content/uploads/2019/09/sk23logo.svg Martin Toner Web Designer Developer2014-07-23 09:45:172014-07-23 09:54:44Magento Delete All Tables Prefixed With ‘wp_’

Pages

  • About
  • Blog
  • Competition Website Design
  • Contact
  • E-Commerce Shopping Cart Development
  • Home
  • Magento CE E-Commerce Shopping Cart Web Development
  • Payment Confirmation
  • Payment Failed
  • School Website Design
  • Serious Coding
  • Simple Unlimited Page Website
  • Testimonials
  • Thanks
  • Web app & website integration
  • Website Management
  • Website Design & Development
  • Buxton Web Designer + Developer
  • High Peak Web Designer
  • Recent Web Design Projects Portfolio

Categories

  • Code Snippets
  • Design
  • Fun Stuff
  • Latest Work
  • Magento
  • Magento Guides
  • Magento Modules
  • MySql
  • Our Work
  • PHP
  • PHP Development Work
  • Website work.
  • Wordpress

Archive

  • February 2024
  • February 2023
  • October 2022
  • June 2022
  • August 2019
  • December 2016
  • July 2014
  • April 2014
  • September 2013
  • June 2013
  • March 2013
  • February 2013
  • October 2012
  • May 2012
  • February 2012
  • January 2012
  • October 2011
  • September 2011
  • February 2011
  • January 2011
  • October 2010

Contact Us

If you are looking for a new website , e-commerce store, web application or just some advice please get in touch.

info@sk23.co.uk 01298 816080

Address

SK23Design
Suite 1,
4 Market St,
Chapel-en-le-Frith,
High Peak SK23 0HH

Partners

Recent

  • Magento 2.4 – Why Your Custom Theme’s Css Is Not Being Compiled
  • Magento 2.4 – Change Product Details From Tabs to Accordion On Desktop
  • Magento 2.4 Bulk Updates Not Working Or Appearing In The Action Log
  • Magento 2.4 Disable Page Builder For Category Description
  • Magento 2 UK Shipping

Categories

  • Code Snippets
  • Design
  • Fun Stuff
  • Latest Work
  • Magento
  • Magento Guides
  • Magento Modules
  • MySql
  • Our Work
  • PHP
  • PHP Development Work
  • Website work.
  • Wordpress
  • Web Design High Peak
  • Web Design Buxton
  • Web Designer Chapel-en-le-Frith
  • Loqate
2026 © Copyright - SK23 Design IT - Websites and Web Development Services | Website by SK23Design
Highlight Current Post Category In WordPress Categories Widget Using jQuery...Magento Abandoned Cart Email Products List Not Showing Scroll to top