我试图通过my.cnf更改MySQL的字符集,但失败了。我添加了下面列出的字符集设置:
# The MySQL server
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
# ------------- MYSQL CHARSETS --------------
character_set_system = utf8
character_set_server = utf8
character_set_results = utf8
character_set_database = utf8
character_set_connection = utf8
character_set_client = utf8
collation_connection = utf8_general_ci
collation_database = utf8_general_ci
collation_server = utf8_general_ci
启用这些功能后,MySQL无法启动。如何确定所有内容都默认为utf8-始终?
更新资料
还有一些地方存在UTF8问题
character_set_client utf8
character_set_connection utf8
character_set_database latin1
character_set_filesystem binary
character_set_results utf8
character_set_server latin1
character_set_system utf8
character_sets_dir /usr/share/mysql/charsets/
collation_connection utf8_general_ci
collation_database latin1_swedish_ci
collation_server latin1_swedish_ci
不幸的是,我仍然没有想出一个解决方案...有什么想法吗?
目前,我正在成功使用此配置:
[mysqld]
default-character-set = utf8
init-connect='SET NAMES utf8'
character-set-server = utf8
[mysql]
default-character-set = utf8
但是PHPMyAdmin仍然显示一些latin1
character_set_client utf8
character_set_connection utf8
character_set_database latin1
character_set_filesystem binary
character_set_results utf8
character_set_server latin1
character_set_system utf8
character_sets_dir /usr/share/mysql/charsets/
collation_connection utf8_general_ci
collation_database latin1_swedish_ci
collation_server latin1_swedish_ci