MAMP MySQL not recognizing my.cnf values in OSX

爷,独闯天下 提交于 2019-12-04 14:33:48
PHPeer

Included skip-character-set-client-handshake in the [mysqld] group of the my.cnf file and everything seems correctly configured, UTF8 straight through. I'm still not sure why default-character-set=utf8 in the [client] group didn't take here, but I'm a newbie so hopefully someone can shed light there. You must create my.cnf in Applications/MAMP/conf and IN MAMP Pro, you go under the File > Edit Template > MySQL my.cnf to make the changes.

my.cnf:

# The MySQL server
[mysqld]
skip-character-set-client-handshake
collation_server=utf8_unicode_ci
character_set_server=utf8

Results:

mysql> SHOW VARIABLES WHERE variable_name LIKE '%char%' OR variable_name LIKE '%colla%';
+--------------------------+--------------------------------------------+
| Variable_name            | Value                                      |
+--------------------------+--------------------------------------------+
| character_set_client     | utf8                                       |
| character_set_connection | utf8                                       |
| character_set_database   | utf8                                       |
| character_set_filesystem | binary                                     |
| character_set_results    | utf8                                       |
| character_set_server     | utf8                                       |
| character_set_system     | utf8                                       |
| character_sets_dir       | /Applications/MAMP/Library/share/charsets/ |
| collation_connection     | utf8_unicode_ci                            |
| collation_database       | utf8_unicode_ci                            |
| collation_server         | utf8_unicode_ci                            |
+--------------------------+--------------------------------------------+

This also solved why mysqladmin's variables were different than mysql's when using SHOW VARIABLES for each.

Solution mentioned in comments of MySQL manual here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!