Can't initialize character set utf8 (path: /usr/share/mysql/charsets/)


【1】Can't initialize character set utf8] (path: /usr/share/mysql/charsets/) 

【1.1】
報錯信息:
  
  mysql: Character set 'utf8]' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
  mysql: Character set 'utf8]' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file
  ERROR 2019 (HY000): Can't initialize character set utf8] (path: /usr/share/mysql/charsets/) 
 
【1.2】驗證文件字符集,驗證mysql支持的字符集;
  查看字符串是否是mysql支持的,比如把文件放到notpad++中去查看。
  或者進入mysql,查看Mysql支持的字符集有哪些(show charset;)
文件字符集:
  

 

【1.3】usr/share/mysql/charsets/Index.xml

文件:usr/share/mysql/charsets/Index.xml ,看這個文件好像並沒有什么卵用。
  

  一看就知道,無法識別解析字符,看看配置文件

【1.4】my.cnf

  

 

   果然,客戶端字符集設置有問題,修改好后,解決問題。

  這里因為是 [client]的問題,所以不需要重啟mysql,大家可以試試,實在不行再重啟 Mysql。

 

【2】Character set 'utf-8' is not a compiled character set and is not specified

  當出現“Character set 'utf-8' is not a compiled character set and is not specifie”的錯誤時,
  將mysql安裝目錄下的my.ini文件的default-character-set=utf-8更改為default-character-set=utf8即可,
  簡單來說就是將"utf-8"更改為"utf8"即可。
 

【3】Mysql:Character set 'utf8mb4' is not a compiled character set ... 解決方案

連接Mysql時出現如下錯誤
Mysql:Character set 'utf8mb4' is not a compiled character set and is not specified in the '/usr/share/mysql/charsets/Index.xml' file

解決方法如下:

打開文件/usr/share/mysql/charsets/Index.xml
直接復制文件中utf8的配置,改為utf8mb4后,添加到文件中故障解決,更改方式如下

<charset name="utf8mb4">
  <family>Unicode</family>
  <description>UTF-8 Unicode</description>
  <alias>utf-8</alias>
  <collation name="utf8_general_ci" id="33">
   <flag>primary</flag>
   <flag>compiled</flag>
  </collation>
  <collation name="utf8_bin"  id="83">
    <flag>binary</flag>
    <flag>compiled</flag>
  </collation>
</charset>

 

參考文件

字符集問題: https://blog.csdn.net/ACMAIN_CHM/article/details/4174186

Character set 'utf8mb4' is not a compiledhttps://blog.51cto.com/yangjingangel/1754413

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM