mysql 5.5 升级 与 MySQL utf8mb4 字符集

时间:2024-11-13 19:12:18

移除旧版本

yum remove mysql mysql-*


添加源

rpm -Uvh /pub/epel/6/i386/

rpm -Uvh /enterprise/


安装

yum --enablerepo=remi,remi-test install mysql mysql-server


启动

/etc//mysqld start 或 service mysqld start 


mysql_upgrade -uroot -p123456



MySQL utf8mb4 字符集

 修改 /etc/


[client]
default-character-set = utf8mb4


[mysql]
default-character-set = utf8mb4


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


重启 MySQL Server、检查字符集


mysql> SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
+--------------------------+--------------------+
| 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_unicode_ci |
| collation_database      | utf8mb4_unicode_ci |
| collation_server        | utf8mb4_unicode_ci |
+--------------------------+--------------------+
 rows in set (0.00 sec)