If you try to use a character set that is not compiled into your binary, you might run into the following problems:
Your program uses an incorrect path to determine where the
character sets are stored. (Default
/usr/local/mysql/share/mysql/charsets).
This can be fixed by using the
--character-sets-dir option when you run
the program in question.
The character set is a multi-byte character set that cannot be loaded dynamically. In this case, you must recompile the program with support for the character set.
The character set is a dynamic character set, but you do not have a configure file for it. In this case, you should install the configure file for the character set from a new MySQL distribution.
If your Index file does not contain the
name for the character set, your program displays the
following error message:
ERROR 1105: File '/usr/local/share/mysql/charsets/?.conf' not found (Errcode: 2)
In this case, you should either get a new
Index file or manually add the name of
any missing character sets to the current file.
For MyISAM tables, you can check the
character set name and number for a table with
myisamchk -dvv
tbl_name.

User Comments
This BUG in PHP, not in MySQL (PHP 4.3.1, MySQL 3.23.51, Apache 2.0.43, WindowsXP)... I agree with Lubomir Krajcovic about first item but second didn't work... I change "c:\mysql\" to "c:\mysql3" not in libmysql.dll but in php4ts.dll.
Recently I was working on c++ prog (VisualStudio 7.0) that should be ran as a service on Win2kSP3 station stuffing some data to a remote mysql-3.23.53 server via ODBC 3.51. It worked fine in user mode, but if i tried to run it as a service it instantly died with an error:
File 'C:\mysql\\share\charsets\?.conf' not found (Errcode: 2)
Character set '#14' is not a compiled character set and is not specified in the 'C:\mysql\\share\charsets\Index' file.
Web search brought no success, as most people had this trouble with mysql server service, not ODBC-client. It was a great luck indeed when i ran into a russian USENET thread with a very strange but effective solution:
I just copied all contents of "/usr/local/mysql/share/mysql/charsets" directory from my remote FreeBSD 4.4 box to "C:\mysql\share\charsets\" on my Win2kSP3 station. And it worked!
I would really appreciate any explanation from anybody with deeper understanding of MySQL and MySQL ODBC 3.51 on such strange behaviour.
I also got all those pretty stuff with cp1251:
1) created empty database
2) restored data into it from sql file
3) run myisamchk - ALL tables with varchar (i.e. russian strings) are reported having errors! in clean database!!!
I was really confused... :(((
Then I found some good advice somewhere - I wrote "character-sets-dir=" also into [client] and [myisamchk] sections of my.cnf (before it was only in [mysqld]) and "default-character-set=cp1251" in [client] (dont know if it's really needed) - run myisamchk with "--set-character-set=cp1251" on all tables - MIRACLE! all damn things were fixed! ...
still I dont understand why did myisamchk not understand command line key "--character-sets-dir" and only modifying of my.cnf helped. I wonder...
File 'C:\mysql\\share\charsets\?.conf' not found (Errcode: 22)
Character set '#51' is not a compiled character set and is not specified in the 'C:\mysql\\share\charsets\Index' file
I had the same error in WINXP. Even I had copied from both Linux and BSD installations - this didn't help me. I have even installation in c:\ptorgam files\mysql.
My Solution: I just created c:\mysql\share\charsets and copied from original folder all files, and added into "Index" file new row (with encoding I use):
cp1251 51
Now I don't get any errors. In all my linux/bsd machines I ve never seen this error.
The C:\mysql directory appears to only be hardcoded when trying to look for information on character sets that are not compiled with the installation. Given that, here is a better way to workaround the problem:
First, go into mysql for your database and do "show collation;" and look for character sets with "Yes" under the Compiled column. Then, edit your my.cnf file and set collation-server (under [mysqld]) to one of these character sets -- preferably one that is closest to what your data uses. Bounce the mysqld server, and the errors should go away.
I had this problem when my MySQL was using utf-8.. File utf-8.xml is not present where he has to -> c:\mysql\share\charsets.. I changed default coding to cp1250 and now it is working ..
The "?.conf''" problem may also be caused by an outdated DBD::mysql perl package.
If you used an old version of MySQL (say, 3.23) and then upgraded your system to MySQL 4.1, you may encounter such a problem with your perl scripts.
Just run cpan and issue an 'install DBD::mysql' command.
After you update your DBD::mysql package the charset problem should be gone.
At least it worked for me.
Hi guys!
Here You are OVERALL solution for 4.1 that makes Your php (for example) code "crosshosted" i.e. it will not depend on MySQL server charset options (it's very useful when host admin is not available :) ) :
After connecting (@mysql_connect) and selecting (@mysql_select_db) a database You should make the following:
$set = @mysql_query ('SET NAMES CP1251');
$set = @mysql_query ('SET COLLATION_CONNECTION=CP1251_GENERAL_CI');
may be just first SET is enough even.
Remove ANY stuff concerning charsets from my.ini (my.cnf) just forget it and set connection properties as above. Some stupid strings from errors.log will gone as bonus :)
The comments by Gotz helped me out a lot. I thought I would also add the following comments to expand on his line of thought:
This is a quick hack to generate the necessary Index file:
#!/bin/bash
mv Index.xml Index.xml.tmp
i="1"
for filename in $( ls *.xml | sort )
do
echo "$filename $i" >> Index
i=`expr $i + 1`
done
mv Index.xml.tmp Index.xml
I would also like to mention that I got the errors when I configured using "--with-charset=utf8". When I removed that, problem went away. The docs say that latin1 is the default, which is good enough for me. Easy fix is to avoid specifying the charset if you can live with the defaults.
hello. i am using ActivePerl 5.8.6.811 and MySQL 4.1.9 (in "D:\web\mysql") on Win2kSP4.
i got error
"File 'C:\mysql\\share\charsets\?.conf' not found (Errcode: 2)Character set '#51' is not a compiled character set and is not specified in the 'C:\mysql\\share\charsets\Index' file"
connecting using DBI:mysql.
copying to C:\mysql\share... did not solved this problem.
So i have just installed DBI:mysqlPP and use "DBI->connect('DBI:mysqlPP...". It Works!
ha haa :)) I know the answer ,finally !!!
If you see this error,just create "C:/mysql/share/" like Alexandre said,and copy a well-working "charsets" file into it.I use mysql 4.1.11,and the files in charsets folder are xml files,and they didn't work.I copied the correct files of a mysql 3.23.33 charsets folder,it contains .conf files.Don't edit any .ini file!just do what i said,and refresh your page...
Have fun !!!
Windows XP, MySQL 4.1.14
About the charset problem, I added character-sets-dir="C:\Program Files\MySQL\MySQL Server 4.1\\share\charsets"
under [client] in my.ini and it worked!
Watch out for double \ before share...
\s is converted to space character so we have to escape backslash...
I had the same problem.
I did a check with myisamchk -dvv and found out that one of the tables had a problem with the charset. The type was not in the /usr/local/mysql/charset/Index. So I edited this file and put the characterset in there. The next I did was to set the right charset myisamchk --set-character-set=<your_character>.
Another thing you could do is find out the table with the character problem and backup its content and create a new one and put the content back.
I had problem with inserting cyrillic data into mysql table. I added
default-character-set=cp1251
character_set_client=cp1251
in my.ini file, and now it works fine.
Win2000 Czech, MySQL 5.0.17-nt
On Character Set Dialog Page in the MySQL Configuration Wizard I set 3rd option (Manual Selected) and Character Set as cp1250.
When I tried connect into mysql server via mysql.exe command, it fails with message "mysql: Character set 'cp1250' is not a compiled character set and is not specified in the 'C:\mysql\\share\charsets\Index.xml' file".
Solution was simple (thanks Ozan Hazer's message above) - I added
character-sets-dir="C:\Program Files\MySQL\MySQL Server 5.0\\share\charsets\"
under [client] section in my.ini and everything works :-)
I setup MySQL 5.0.18 on a Windows 2000 SP4 machine.
I used "mysql-essential-5.0.18-win32.msi" installer package for installation. I
configured character set to latin5 (with MySQL Server Instance Config Wizard).
Server started without any problem but when I try to use "mysql" command line
tool I saw following error message and mysql client could not start;
mysql: Character set 'latin5' is not a compiled character set and is not
specified in the 'C:\mysql\\share\charsets\Index.xml' file
After this error I add following line(character-sets-dir) into my.ini file and
now it is working.
# CLIENT SECTION
...
[mysql]
default-character-set=latin5
character-sets-dir="C:/Program Files/MySQL/MySQL Server 5.0/share/charsets"
I reported this as a bug. Bug #17271
Add your own comment.