MySQL报错: Character set ‘utf8mb4‘ is not a compiled character set and is not specified in the ‘/usr/share/mysql/charsets/Index.xml‘ file

由于日常程序使用了字符集utf8mb4,为了避免每次更新时,set names utf8mb4,就把配置文件改了,如下:

[root@~]# vim /etc/my.cnf

#my.cnf

[client]

port            = 3306

socket          = /home/mysql/mysql.sock

default-character-set=utf8mb4

重启MySQL服务,进入mysql时,就报错:

[root@~]# mysql

Logging to file ‘/home/mysql/query.log‘

mysql: Character set ‘utf8mb4‘ is not a compiled character set and is not specified in the ‘/usr/share/mysql/charsets/Index.xml‘ file

解决办法:

经查mysql命令调用的是/usr/bin下的

[root@ ~]# ls /usr/bin/ |grep mysql

msql2mysql

mysql

mysqlaccess

mysqladmin

mysqlbinlog

mysqlcheck

mysql_config

mysqld_multi

mysqld_safe

mysqldump

mysql_find_rows

mysqlimport

mysqlshow

mysqlslap

mysql_waitpid

发现该服务器上在我安装mysql5.5.20之前,安装过mysql5.1的客户端

[root@ ~]# rpm -qa |grep mysql

mysql-5.1.73-3.el6_5.x86_64

mysql-libs-5.1.73-3.el6_5.x86_64

将mysql5.5.20下的mysql命令全部拷贝到/usr/bin目录下

cp /usr/local/Percona-Server-5.5.20-rel24.1-217.Linux.x86_64/bin/* /usr/bin/

修改完后,再次使用进入mysql,OK~

本文参考 “菜鸟地盘” 博客,请务必保留此出处http://yangjingangel.blog.51cto.com/8351501/1754413

上一篇:Android Support Annotations :安卓注解快速上手


下一篇:MySQL数据分组Group By 和 Having