我已经将 php-mysql-apache 设置为在 latin1 上工作,但是在进行备份时我的字符集客户端仍然是 utf8
是的,我知道你的想法,但目前我们决定选择 latin1。
这是 mySQL 配置: • mysql>显示类似“character_set_%”的变量;
• +--------------------------+--------+
•|变量名 |价值 |
• +--------------------------+--------+
•|字符集客户端 |拉丁语1 |
•|字符集连接 |拉丁语1 |
•|字符集数据库 |拉丁语1 |
•|字符集结果 |拉丁语1 |
•|字符集服务器 |拉丁语1 |
•|字符集系统 | utf8 |> >这是不可能更改的,因为它是默认的系统参数。
对于 php,我们在 php.ini 中使用以下命令:
mssql.charset = "ISO-8859-1"
对于 apache 通常:
AddDefaultCharset ISO-8859-1
每次我们进行备份时,我们都会将以下内容添加到每个表中:
/*!40101 SET @saved_cs_client = @@character_set_client /;
/!40101 SET character_set_client = utf8 */;
为什么apache/php和mysql之间的连接character_set_client仍然是utf8?
Yes, I know what you think, but for the moment we decided to go for latin1.
This is the mySQL config:
• mysql> SHOW VARIABLES LIKE 'character_set_%';
• +--------------------------+--------+
• | Variable_name | Value |
• +--------------------------+--------+
• | character_set_client | latin1 |
• | character_set_connection | latin1 |
• | character_set_database | latin1 |
• | character_set_results | latin1 |
• | character_set_server | latin1 |
• | character_set_system | utf8 |> This is impossible to change since it is a default system parameter.
For php we use the following commands at php.ini:
mssql.charset = "ISO-8859-1"
For apache the usual:
AddDefaultCharset ISO-8859-1
With all this everytime we do back up we get the following added to each table:
/*!40101 SET @saved_cs_client = @@character_set_client /;
/!40101 SET character_set_client = utf8 */;
Why the character_set_client is still in utf8 for connections between apache/php and mysql?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
mysqldump 不会查看您的 php 或 apache 设置。使用 mysqldump 时,您需要添加
--default-character-set
标志。来自手册:
mysqldump doesn't look at your php or apache settings. You'll need to add the
--default-character-set
flag when using mysqldump.From the manual:
如果您仔细注意到您在 php.ini 中设置的指令:
指的是 Microsoft SQL Server! 连接,而不是
MySQL Server
。杰克曼
if you notice carefully the directive in the php.ini you have set:
refers to
Microsoft SQL Server!
connections and not toMySQL Server
.jackman