Bug #3990 `--with-charset' ./configure's switch doesn'taffect mysql client library.
Submitted: 3 Jun 2004 20:33 Modified: 9 Jun 2004 22:21
Reporter: Sergey Kostyliov Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.2 OS:Linux (Linux (Gentoo 2004.1))
Assigned to: Alexander Barkov CPU Architecture:Any

[3 Jun 2004 20:33] Sergey Kostyliov
It looks like `--with-charset' ./configure's switch doesn't affect mysql 
client library. 
After reading through the code I found: 
line: 1786 
 if (mysql->options.charset_name) 
    mysql->charset= default_charset_info; 
Where default_charset_info comes from mysys/charset.c 
line 427: 
CHARSET_INFO *default_charset_info = &my_charset_latin1; 
And AFAICS there is no way to set default charset for client library in my.cnf 
for mysql >= 4.1. 
So for now, if I understand this correctly, all third parties API (php, perl, 
etc) became broken for non-latin1 users in some way (i.e. all scripts that 
have been working fine for mysql < 4.1 doesn't works anymore.) 

How to repeat:
`SELECT id FROM tasklist WHERE state = 'active';' 
ERROR 1267 (HY000): Illegal mix of collations (cp1251_general_ci,IMPLICIT) and 
(latin1_swedish_ci,COERCIBLE) for operation '=' 

Suggested fix:
I see three possible alternatives: 
1) Changes to to all users scripts: 
Basically add /*!40101 SET NAMES $my_charset */ right below the each connect 
in every user script. That seems not acceptable for me :( 
2) Patches for all third-parties API: 
New variable for tools with global config files, and possibly compile time 
parameters for others. 
While this sounds weird I believe that the patches themself would be very 
tiny. In fact I already did one for php :). 
3) Changes to mysql_real_connect(). I could not comment on this.
[4 Jun 2004 23:51] Dean Ellis
Verified against 4.1.3.  Though mysql --help shows default-character-set utf8, unless the option is explicitly set it reverts to latin1 on connect.
[9 Jun 2004 22:21] Sergei Golubchik
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at

Additional info:

fixed in 4.1.3
[20 Apr 2006 9:11] Alexander Motin
What about fixing same on 5.x branch? I have found this bug on 5.0.19