一、批量修改数据表的前缀
批量生成命令
原表前缀4位,新表前缀npre_,schema是my_database
SELECT CONCAT( 'ALTER TABLE ', table_name, ' RENAME TO npre_', substring(table_name, 4),';')
FROM information_schema.tables
WHERE table_schema='my_database' and table_name LIKE 'lw_%';
批量执行命令
在数据库中执行上述命令生成的数据库表修改脚本
二、批量修改字段的前缀
批量生成命令
批量执行命令
三、批量修改索引的前缀