In MySQL, how do I batch rename tables within a database?
问题 So basically I have a joomla database in MySQL which has a bunch of tables that have the prefix 'jmla_'. I would like to rename all of these tables by replacing the 'jmla_' prefix with a 'jos_' prefix. Any ideas about how to do this with a simple SQL script or SQL query? 回答1: SELECT concat ('rename table ',table_name,' to ',table_name,'_old;') FROM information_schema.tables WHERE table_name like 'webform%' and table_schema='weiss_db_new' will work. 回答2: Run this statement: SELECT 'rename