mysql批量修改表后缀:
SELECT
CONCAT(
'RENAME TABLE ',
table_name,
' TO ',
REPLACE(table_name, '_copy1', ''),
';'
) AS rename_query
FROM
information_schema.tables
WHERE
table_schema = 'douyin'
AND table_name LIKE '%_copy1';
上述语句会生成下面的rename语句,需要复制出来然后执行,一定要检查一下:
RENAME TABLE xxx_account_copy1 TO xxx_account;
RENAME TABLE xxx_admin_copy1 TO xxx_admin;
RENAME TABLE xxx_config_copy1 TO xxx_config;
RENAME TABLE xxx_gg_copy1 TO xxx_gg;
RENAME TABLE xxx_info_copy1 TO xxx_info;
RENAME TABLE xxx_interface_copy1 TO xxx_interface;
RENAME TABLE xxx_jxlog_copy1 TO xxx_jxlog;
RENAME TABLE xxx_kami_copy1 TO xxx_kami;
RENAME TABLE xxx_loginlog_copy1 TO xxx_loginlog;
RENAME TABLE xxx_mail_config_copy1 TO xxx_mail_config;
RENAME TABLE xxx_notice_copy1 TO xxx_notice;
RENAME TABLE xxx_order_copy1 TO xxx_order;
RENAME TABLE xxx_paytype_copy1 TO xxx_paytype;
RENAME TABLE xxx_viplog_copy1 TO xxx_viplog;
RENAME TABLE xxx_viptype_copy1 TO xxx_viptype;