{ mysql } MySQL collation问题

Illegal mix of collations (latin1_general_cs,IMPLICIT) and (latin1_general_ci,IMPLICIT) for operation '='

原因是collation的编码不一致,不想重启Server,于是看到如下方案

set global collation_connection=utf8mb4_unicode_ci;
set global collation_database=utf8mb4_unicode_ci;
set global collation_server=utf8mb4_unicode_ci;

and

set collation_connection=utf8mb4_unicode_ci;
set collation_database=utf8mb4_unicode_ci;
set collation_server=utf8mb4_unicode_ci;

理想很丰满,但现实真的很骨感。本想service mysql reload可以生效,可以完美的不重启Server,结果是不起作用。

为了避免重启后设置恢复,在server.cnf中也做了相应的配置

[mysqld]
character-set-server = utf8mb4
character-set-client-handshake = FALSE
collation-server = utf8mb4_unicode_ci
init_connect = 'SET NAMES utf8mb4'

service mysql restart 用金星话来来说,那就是"完美".

你可能感兴趣的:({ mysql } MySQL collation问题)