MySQL connection failed: Can't initialize character set charset_name
./configure --with-charset=charset_name --with-extra-charsets=complex--with-extra-charsets=complex,支援所有多位元組字元集。.conf/.xml 定義檔。mysql --character-sets-dir=/usr/local/mysql/share/charsetsmysql_options(&mysql, MYSQL_SET_CHARSET_DIR, "/path")。$MYSQL_BASE/share/charsets 或 /usr/share/mysql/charsets)。SHOW CHARACTER SET LIKE 'charset_name';mysql --help | grep -A1 'character-sets-dir'ls -l /usr/share/mysql/charsets/Index.xmlexport MYSQL_CHARSET_DIR=/custom/pathjdbc:mysql://host/db?characterEncoding=utf8mb4&connectionCollation=utf8mb4_unicode_ci字元集初始化失敗多為客戶端庫編譯缺失或定義檔路徑不匹配。標準化部署:使用官方完整二進制包、統一 utf8mb4、顯式指定連線字元集、將 character-sets-dir 納入配置管理,即可杜絕此類問題。