mysql报错问题解决Character set 'utf8mb4' is not a compiled character set

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

报错的解决方法

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

增加了mysql客户端的默认字符集设置

[[email protected]~]# vim /etc/my.cnf

#my.cnf

[client]

port            = 3306

socket          = /home/mysql/mysql.sock

default-character-set=utf8mb4

2、重启mysql服务

[[email protected]~]# service mysql restart

Shutting down MySQL (Percona Server).... SUCCESS!

Starting MySQL (Percona Server).... SUCCESS!

3、进入mysql时,报错:

[[email protected]~]# 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

4、百度了一个解决方法:

[[email protected]~]# vim /etc/my.cnf

#my.cnf

[client]

port            = 3306

socket          = /home/mysql/mysql.sock

character-sets-dir=/usr/local/Percona-Server-5.5.20-rel24.1-217.Linux.x86_64/share/charsets

default-character-set=utf8mb4

5、重启mysql后,还是报同样的错

[[email protected]~]# service mysql restart

Shutting down MySQL (Percona Server).... SUCCESS!

Starting MySQL (Percona Server).... SUCCESS!

[[email protected]~]# 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

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

[[email protected] ~]# 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

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

[[email protected] ~]# rpm -qa |grep mysql

mysql-5.1.73-3.el6_5.x86_64

mysql-libs-5.1.73-3.el6_5.x86_64

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

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

9、5.5.20相比5.1版本增加了不少命令

[[email protected]~]# ls /usr/bin/ |grep mysql

msql2mysql

mysql

mysqlaccess

mysqlaccess.conf

mysqladmin

mysqlbinlog

mysqlbug

mysqlcheck

mysql_client_test

mysql_config

mysql_convert_table_format

mysqld

mysqld_multi

mysqld_safe

mysqldump

mysqldumpslow

mysql_find_rows

mysql_fix_extensions

mysqlhotcopy

mysqlimport

mysql_install_db

mysql_plugin

mysql_secure_installation

mysql_setpermission

mysqlshow

mysqlslap

mysqltest

mysql_tzinfo_to_sql

mysql_upgrade

mysql_waitpid

mysql_zap

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

mysql报错问题解决Character set 'utf8mb4' is not a compiled character set

时间: 03-23

mysql报错问题解决Character set 'utf8mb4' is not a compiled character set的相关文章

Character set 'utf8mb4' is not a compiled character set

最近在一次MySQL数据迁移的过程中遭遇了字符集的问题,提示为"Character set 'utf8mb4' is not a compiled character set".即是字符集utf8mb4不是一个编译的字符集以及没有在Index.xml文件里指定.下面是其处理过程及解决办法,供大家参考. 1.错误提示SHELL> mysqlbinlog --database=bs_salary --stop-datetime="2014-12-15 8:24:48&quo

mysql报错: Unknown character set: 'utf8mb4'

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown character set: 'utf8mb4' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImp

python报错问题解决:'ascii' codec can't encode character

python在安装时,默认的编码是ascii,当程序中出现非ascii编码时,python的处理常常会报这样的错,python没办法处理非ascii编码的,此时需要自己设置将python的默认编码,一般设置为utf8的编码格式. 查阅网上,可以在程序中修改所有涉及到编码的地方,强制编码为utf8,即添加代码encode("utf8"),这种方法并不推荐使用,因为一旦少写一个地方,将会导致大量的错误报告. 解决方案: 在python的lib\site-packages文件夹下新建一个si

MySQL报错:Cause: java.sql.SQLException: Incorrect string value: '\xE6\x9D\xA8","...' for column 'obj_value' at row 1

1.插入MySQL表时,报错:Cause: java.sql.SQLException: Incorrect string value: '\xE6\x9D\xA8","...' for column 'obj_value' at row 1 错误原因:参数中带有emoji表情,插入数据库时,一些特殊字符如“繁星拜月??”,插入报异常 解决思路:因为字符编码集为utf8,不支持一些basic multilingual plane和补充字符,那么如何让mysql存储emoji表情,所以需

解决mysql报错Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’

启动mysql 报错: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 1.先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.另外看看是不是权限问题. 2.确定你的mysql.sock是不是在那个位置,mysql -u 你的mysql用户名 -p -S /var/lib/mysql/

Mysql报错 Cannot load from mysql.proc

Auth: Jin Date: 20140716 mysql --default-character-set utf8 -h127.0.0.1 -uroot -p < account-20140716-1.sql ERROR 1548 (HY000) at line 57: Cannot load from mysql.proc. The table is probably corruptedmysql> SHOW PROCEDURE status; ERROR 1548 (HY000): C

1130 - Host&#39;xxx.xxx.xxx.xxx&#39; is not allowed to connect to this MySQL server解决Navicat连接MySQL报错

最近使用Navicat for MySQl访问远程mysql数据库,出现报错,显示"1130 - Host'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server".解决办法如下: 方法/步骤 首先看报错窗口. 经查阅,错误原因是:本地IP(xxx.xxx.xxx.xxx)没有访问远程数据库的权限. 于是下面开启本地IP(xxx.xxx.xxx.xxx)对远程mysql数据库的访问权限. 首先远程连接进入服务器,在

连接mysql报错Access denied for user &#39;root&#39;@&#39;localhost&#39; (using password: YES)解决办法

1.打开MySQL目录下的my.ini文件,在文件的最后添加一行"skip-grant-tables"(免密码登录),保存并关闭文件,重启MySQL服务. 2.通过命令行进入MySQL的BIN目录,输入"mysql -u root -p"(不输入密码),回车即可进入数据库. 3.执行"use mysql;",使用mysql数据库. 4.修改密码:执行" update MySQL.user set authentication_strin

解决MySql报错:1130 - Host &#39;xxx&#39; is not allowed to connect to this MySQL server的方法

发现问题 使用Navicat连接MySql数据库时,未能成功,提示信息如下图: 这个错误提示已经很明确了,"不允许主机'desktop-teat9ob'连接到此mysql服务器",知道问题所在就好解决了. 解决办法 我们远程联接到MySql服务器,打开服务器本地Navicat软件,在查询编辑器中执行下面的SQL语句 #查询允许连接的主机及用户信息 select Host,User,Password from mysql.user; 结果如下图: 从结果中可以看到,MySql只允许使用r