修改表名 ALTER TABLE 原表名 RENAME TO 新表名; 一句SQL语句只能修改一张表 show tables; 1. SELECT CONCAT( 'ALTER TABLE ', table_name, ' RENAME TO db_', substring(table_name, ), ';' ) FROM information_schema. TABLES WHERE table_name LIKE 'ct%'; 批量复制一下到Notepad++中,只保留sql语句,再复制…
批量删除2000w数据 使用delete from table太慢 //DELIMITER DROP PROCEDURE if EXISTS deleteManyTable; create PROCEDURE deleteManyTable() BEGIN DECLARE i int; ; DO ) ; SELECT SLEEP(0.5); ; end while; END; //DELIMITER CALL deleteManyTable(); 参考文献: http://mysql.rjweb…