将 MySQL connection/server 设置为 utf8mb4 而不是 uft8 会破坏 SQLYog 中的存储过程
Setting MySQL connection/server to utf8mb4 instead of uft8 is breaking stored procedures in SQLYog
无论我尝试打开存储过程还是创建一个新的存储过程,SQLYog 都出现以下错误:
COLLATION 'utf8_bin' is not valid for CHARACTER SET 'utf8mb4'
他们可以从服务器正确执行,但是在 SQLYog 上他们一直给出这个错误代码。
我用 SET collation_connection = @@collation_database;
暂时解决了这个问题,但我想知道是否有更永久的解决方案?
来自 SQLyog:
SET NAMES 'utf8mb4' COLLATE 'utf8_bin';
Error Code: 1253
COLLATION 'utf8_bin' is not valid for CHARACTER SET 'utf8mb4'
尝试:
SET NAMES 'utf8mb4' COLLATE 'utf8mb4_bin';
使用 SQLyog Community v12.2.2(64 位)和 MySQL 5.5.49 可以毫无问题地修改(打开)和创建新的存储过程。
VERSION()
-----------
5.5.49
SET NAMES 'utf8mb4' COLLATE 'utf8mb4_bin';
SET SESSION collation_connection = 'utf8mb4_bin',
collation_server = 'utf8mb4_bin',
collation_database = 'utf8mb4_bin';
SHOW VARIABLES WHERE
`Variable_Name` != 'character_sets_dir' AND
(`Variable_Name` LIKE '%CHAR%' OR
`Variable_Name` LIKE '%COLL%');
Variable_name Value
------------------------ -------------
character_set_client utf8mb4
character_set_connection utf8mb4
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8mb4
character_set_server utf8mb4
character_set_system utf8
collation_connection utf8mb4_bin
collation_database utf8mb4_bin
collation_server utf8mb4_bin
无论我尝试打开存储过程还是创建一个新的存储过程,SQLYog 都出现以下错误:
COLLATION 'utf8_bin' is not valid for CHARACTER SET 'utf8mb4'
他们可以从服务器正确执行,但是在 SQLYog 上他们一直给出这个错误代码。
我用 SET collation_connection = @@collation_database;
暂时解决了这个问题,但我想知道是否有更永久的解决方案?
来自 SQLyog:
SET NAMES 'utf8mb4' COLLATE 'utf8_bin';
Error Code: 1253
COLLATION 'utf8_bin' is not valid for CHARACTER SET 'utf8mb4'
尝试:
SET NAMES 'utf8mb4' COLLATE 'utf8mb4_bin';
使用 SQLyog Community v12.2.2(64 位)和 MySQL 5.5.49 可以毫无问题地修改(打开)和创建新的存储过程。
VERSION()
-----------
5.5.49
SET NAMES 'utf8mb4' COLLATE 'utf8mb4_bin';
SET SESSION collation_connection = 'utf8mb4_bin',
collation_server = 'utf8mb4_bin',
collation_database = 'utf8mb4_bin';
SHOW VARIABLES WHERE
`Variable_Name` != 'character_sets_dir' AND
(`Variable_Name` LIKE '%CHAR%' OR
`Variable_Name` LIKE '%COLL%');
Variable_name Value
------------------------ -------------
character_set_client utf8mb4
character_set_connection utf8mb4
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8mb4
character_set_server utf8mb4
character_set_system utf8
collation_connection utf8mb4_bin
collation_database utf8mb4_bin
collation_server utf8mb4_bin