mysql 5.5 升级 与 MySQL utf8mb4 字符集

移除旧版本

yum remove mysql mysql-*


添加源

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm


安装

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


启动

/etc/init.d/mysqld start 或 service mysqld start 


mysql_upgrade -uroot -p123456



MySQL utf8mb4 字符集

 修改 /etc/my.cnf


[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)


你可能感兴趣的:(mysql 5.5 升级 与 MySQL utf8mb4 字符集)