改所有表的字符集:
这个可以运行:
/*更改discuz数据库中每个表的字符集为utf8,校对规则为utf8_bin */
CALL qifei();
DROP PROCEDURE IF EXISTS qifei;
CREATE PROCEDURE qifei()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE a VARCHAR(80);
DECLARE rs CURSOR FOR SELECT t.TABLE_NAME AS lbg FROM information_schema.TABLES t where t.TABLE_SCHEMA='jshoper3';
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
open rs;
REPEAT
FETCH rs INTO a;
SET @s = CONCAT(' ALTER TABLE `',a,'` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin');
SELECT @s;
PREPARE stmt FROM @s;
EXECUTE stmt;
UNTIL done END REPEAT;
CLOSE rs;
END
这个可以运行:
/*更改discuz数据库中每个表的字符集为utf8,校对规则为utf8_bin */
CALL qifei();
DROP PROCEDURE IF EXISTS qifei;
CREATE PROCEDURE qifei()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE a VARCHAR(80);
DECLARE rs CURSOR FOR SELECT t.TABLE_NAME AS lbg FROM information_schema.TABLES t where t.TABLE_SCHEMA='jshoper3';
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
open rs;
REPEAT
FETCH rs INTO a;
SET @s = CONCAT(' ALTER TABLE `',a,'` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin');
SELECT @s;
PREPARE stmt FROM @s;
EXECUTE stmt;
UNTIL done END REPEAT;
CLOSE rs;
END