开发者

I have set php-mysql-apache to work on latin1 but when doing back-ups my character-set client is still utf8

开发者 https://www.devze.com 2023-01-19 17:20 出处:网络
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_%\';

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 |

• | cha开发者_开发技巧racter_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?


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:

--default-character-set=charset_name

Use charset_name as the default character set. See Section 9.5, “Character Set Configuration”. If no character set is specified, mysqldump uses utf8, and earlier versions use latin1.


if you notice carefully the directive in the php.ini you have set:

mssql.charset = "ISO-8859-1"

refers to Microsoft SQL Server! connections and not to MySQL Server.

jackman

0

精彩评论

暂无评论...
验证码 换一张
取 消