mysql batch modify table name or prefix

Generally used to modify data table prefixes in batches
  1. First query all table names and copy them to the editor
SELECT
	table_name 
FROM
	information_schema.TABLES 
WHERE
	table_schema = 'db_name'; // 数据库名称

Insert image description here

  1. Then use the editor to modify the table names in batches, generate and execute mysql statements for modification
ALTER TABLE table_name1 RENAME	table_name2; // 修改数据表名Sql语句:
// table_name1(要修改的表名)table_name2(新表名)

Insert image description hereInsert image description hereInsert image description hereInsert image description here

Guess you like

Origin blog.csdn.net/qq_15957557/article/details/126621316