LC_COLLATE value showed by the locale command is not necessarily quoted. And if it's not mysqld initscript always sets charset to latin1. $ rpm -q MySQL-server MySQL-server-4.0.17-alt1
Created attachment 327 [details] initscript-charset.patch
if you setup locale from /etc/sysconfig/i18n or by LC_ALL var, LC_COLLATE var would be always quoted. But if you run LC_COLLATE=ru_RU.KOI8-R service mysqld start, charset detection would failed - it's incorrect. How do you run mysqld? How to reproduce this bug? Latin1 sets up always in follow cases: if didn't set CHSET var in mysqld initscript or autodetection didn't find proper charset.
$ service mysqld start Adjusting environment for mysqld: [ DONE ] Unable to find proper charset from system locale, setting 'latin1'. Please edit mysqld init script and set proper charset. Starting safe_mysqld service: [ DONE ] $ cat /etc/sysconfig/i18n SYSFONT=UniCyr_8x16 LC_CTYPE=ru_RU.KOI8-R LC_MONETARY=ru_RU.KOI8-R LANGUAGE=ru_RU.KOI8-R LC_TIME=ru_RU.KOI8-R LC_NUMERIC=ru_RU.KOI8-R LC_COLLATE=ru_RU.KOI8-R LC_MESSAGES=ru_RU.KOI8-R LANG=ru_RU.KOI8-R SYSFONTACM=koi8-r $ locale LANG=ru_RU.KOI8-R LC_CTYPE=ru_RU.KOI8-R LC_NUMERIC=ru_RU.KOI8-R LC_TIME=ru_RU.KOI8-R LC_COLLATE=ru_RU.KOI8-R LC_MONETARY=ru_RU.KOI8-R LC_MESSAGES=ru_RU.KOI8-R LC_PAPER="ru_RU.KOI8-R" LC_NAME="ru_RU.KOI8-R" LC_ADDRESS="ru_RU.KOI8-R" LC_TELEPHONE="ru_RU.KOI8-R" LC_MEASUREMENT="ru_RU.KOI8-R" LC_IDENTIFICATION="ru_RU.KOI8-R" LC_ALL=
It won't to reproduce. I'll apply this patch as workaround. Wait for alt2. And what is your system name/version?
Originally it was Master 2.0 long ago. Now it's partly old Sisyphus, partly current Sisyphus. $ rpm -q glibc-locales sh glibc-locales-2.2.6-alt0.11 sh-2.05b-alt6
BTW, look what I've found: $ locale | fgrep LC_COLLATE LC_COLLATE=ru_RU.KOI8-R $ unset LC_COLLATE $ . /etc/sysconfig/i18n $ locale | fgrep LC_COLLATE LC_COLLATE="ru_RU.KOI8-R" Weird, isn't it?
Proposed change from Alexey Morozov default_charset="$(. /etc/sysconfig/i18n && locale | sed -ne 's/^LC_COLLATE="\?[^".]\+\.\([^"]\+\)"\?$/\1/p')"
*** Bug 3709 has been marked as a duplicate of this bug. ***
fixed in 4.0.18-alt1