Bug #11972 client uses wrong character set after reconnect
Submitted: 15 Jul 2005 15:39 Modified: 13 Sep 2006 16:40
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0.10 OS:Any (all)
Assigned to: Iggy Galarza CPU Architecture:Any

[15 Jul 2005 15:39] Georg Richter
Description:
When client tries to reconnect to the server the previous used character set is not set.

How to repeat:
mysql> show variables like 'character_set_client' \G
*************************** 1. row ***************************
Variable_name: character_set_client
        Value: latin1
1 row in set (0.00 sec)

mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'character_set_client' \G
*************************** 1. row ***************************
Variable_name: character_set_client
        Value: utf8
1 row in set (0.00 sec)

mysql> show variables like 'character_set_client' \G
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    1
Current database: *** NONE ***

*************************** 1. row ***************************
Variable_name: character_set_client
        Value: latin1
1 row in set (0.00 sec)
[27 Apr 2006 20:39] Christian Hammers
This bug has been reported for version 4.1.11 to the Debian bug tracking system, too, as http://bugs.debian.org/365050
Can we expect a fix for 5.0?

bye,

-christian-
[27 Apr 2006 20:55] David Ayers
I'm not sure whether S3 (Non-critical) is the right severity level for this bug as it has caused gradual data corruption for us as by subsequent update and insert statements with the wrong character set.
[9 Aug 2006 18:32] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/10219

ChangeSet@1.2249, 2006-08-09 14:33:15-04:00, iggy@rolltop.ignatz42.dyndns.org +3 -0
  Bug #11972: client uses wrong character set after reconnect.
  
  The mysql client uses the default character set on reconnect.  The default character set is now controled 
  by the client charset command while the client is running.  The charset command now also issues a 
  SET NAMES command to the server to make sure that the client's charset settings are in sync with the 
  server's.
[23 Aug 2006 17:26] Timothy Smith
Looks fine, Iggy.  Thanks!
[24 Aug 2006 15:14] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/10840

ChangeSet@1.2259, 2006-08-24 11:15:08-04:00, iggy@rolltop.ignatz42.dyndns.org +3 -0
  Bug #11972: client uses wrong character set after reconnect.
  
  The mysql client uses the default character set on reconnect.  The default character set is now controled by the client charset command while the client is running.  The charset command now also issues a SET NAMES command to the server to make sure that the client's charset settings are in sync with the server's.
[31 Aug 2006 11:45] Magnus BlÄudd
Pushed to 5.0.25
[31 Aug 2006 18:08] Paul DuBois
Noted in 5.0.25 changelog, in section that describes
mysql commands, and in the charset chapter section
that describes the connection character set.

The mysql client used the default character set if it automatically
reconnected to the server, which is incorrect if the character set
had been changed. To enable the character set to remain synchronized
on the client and server, a new mysql command (charset or \C) changes
the default character set and issues a SET NAMES statement. The
changed character set is used for reconnects.

Setting report back to NDI pending merge into 5.1.
[13 Sep 2006 7:58] Timothy Smith
Merged into 5.1.12
[13 Sep 2006 16:40] Paul DuBois
Noted in 5.1.12 changelog.