问题
Whether I try to open the stored procedures or create a new one SQLYog is giving the following error:
COLLATION 'utf8_bin' is not valid for CHARACTER SET 'utf8mb4'
They can execute correctly from the server, but on SQLYog they keep giving this error code.
I temporarily solved the issue with SET collation_connection = @@collation_database;
but I was wondering if there's a more permanent solution?
回答1:
From SQLyog:
SET NAMES 'utf8mb4' COLLATE 'utf8_bin';
Error Code: 1253
COLLATION 'utf8_bin' is not valid for CHARACTER SET 'utf8mb4'
try:
SET NAMES 'utf8mb4' COLLATE 'utf8mb4_bin';
Using SQLyog Community v12.2.2 (64 bit) and MySQL 5.5.49 can modify (open) and create new stored procedures without problem.
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
来源:https://stackoverflow.com/questions/37295565/setting-mysql-connection-server-to-utf8mb4-instead-of-uft8-is-breaking-stored-pr