English 中文(简体)
MAMP MySQL不承认我在OSX中的cnf价值观。
原标题:MAMP MySQL not recognizing my.cnf values in OSX

• 长期去UTF8,并且能够让MAMP安装MySQL,承认我的心脏价值。

MAMP Version 2.0.5 (2.0.5)

MySQL.5.9

my.cnf file:

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
default-character-set=utf8
default-collation=utf8_general_ci
collation_server=utf8_general_ci
character_set_server=utf8
init-connect= SET NAMES utf8 

档案的位置:

/Applications/MAMP/Library/Conf/

My:

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   | latin1                                     |
| character_set_filesystem | binary                                     |
| character_set_results    | utf8                                       |
| character_set_server     | latin1                                     |
| character_set_system     | utf8                                       |
| character_sets_dir       | /Applications/MAMP/Library/share/charsets/ |
| collation_connection     | utf8_general_ci                            |
| collation_database       | latin1_swedish_ci                          |
| collation_server         | latin1_swedish_ci                          |
+--------------------------+--------------------------------------------+

不同条码之间的转换将同时进行<代码>_database。 价值为utf8,但我似乎只收到_server。 反映utf8/utf8_unicode_ci的备选办法:

use tsdb;

+--------------------------+--------------------------------------------+
| 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     | latin1                                     |
| character_set_system     | utf8                                       |
| character_sets_dir       | /Applications/MAMP/Library/share/charsets/ |
| collation_connection     | utf8_general_ci                            |
| collation_database       | utf8_general_ci                            |
| collation_server         | latin1_swedish_ci                          |
+--------------------------+--------------------------------------------+

Tried

set global character_set_server = utf8;

等等,但它并没有重新启动。

这是我第一次与我这样说的,我相信我会忽略一些基本的东西。 我的死因中是否有人失踪? 还是秩序重要?

感谢。

最佳回答

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.

我:

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

成果:

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                            |
+--------------------------+--------------------------------------------+

这还解决了为什么在使用<代码>SHOW VARIABLES时,我的sqladmin变量不同于我的sql。

MySQL手册评论中提到的解决办法:here

问题回答

暂无回答




相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签