DELIMITER $$
/*更改discuz
数据库中每个表的字符集为utf8,校对规则为utf8_bin */
DROP PROCEDURE IF EXISTS `discuz`.`qifei` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `qifei`()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE a VARCHAR(20);
DECLARE rs CURSOR FOR
SELECT `TABLE_NAME` FROM information_schema.`TABLES` where `TABLE_SCHEMA`='discuz';
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');
PREPARE stmt FROM @s;
EXECUTE stmt;
UNTIL done END REPEAT;
CLOSE rs;
END $$
DELIMITER ;