the version is 4.1.12.
show variables like this,
| character_set_client |
latin1
| character_set_connection |
latin1
| character_set_database |
latin1
| character_set_results | latin1
| character_set_server |
latin1
| character_set_system |
utf8
| character_sets_dir |
/usr/share/mysql/charsets/
| collation_connection |
latin1_swedish_ci
| collation_database |
latin1_swedish_ci
| collation_server | latin1_swedish_ci
If the table is like test(name char(30), id1 int(4), id2 int(4))
When I use mysqldump mysql version 3.23.??, l have the flat file row
length is 30+4+4=38.
When I use mysqldump mysql verson 4.1.12, I have the flat file row
length is 30+11+11=52.
I tried mysqldump --set-charset=latin2, I still got a row length=52.
What I should do?
Gleb Paharenko wrote:
Hello.
I've tested your solution. It doesn't work for users which have SUPER
privilege. This mentioned at:
http://dev.mysql.com/doc/mysql/en/server-system-variables.html
However, it works with with ordinary users which don't have SUPER
privilege. Here are pieces of my my.cnf (the init_connect is one big string
without line breaks):
[client]
default_character_set=latin1
[mysqld]
default_character_set=latin2
init_connect='SET @lchar = IF(@@session.character_set_client =
_utf8"latin1", @@global.character_set_client,
@@session.character_set_client); set
@@[EMAIL PROTECTED]; set
@@[EMAIL PROTECTED]; set
@@[EMAIL PROTECTED]; '
When root user connects init_connect doesn't execute and we see:
mysql> show variables like '%char%';
+--------------------------+-------------------------------------------------------------------------------+
| Variable_name | Value |
+--------------------------+-------------------------------------------------------------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin2 |
| character_set_results | latin1 |
| character_set_server | latin2 |
| character_set_system | utf8 |
|
When user without SUPER privilege connects we see:
| Variable_name | Value |
+--------------------------+-------------------------------------------------------------------------------+
| character_set_client | latin2 |
| character_set_connection | latin2 |
| character_set_database | latin2 |
| character_set_results | latin2 |
| character_set_server | latin2 |
| character_set_system | utf8 |
So it works for me.
http://dev.mysql.com/doc/mysql/en/mysqldump.html
Dump & restore was done properly. dump on 4.0, add set names latin2; load i=
nto=20
4.1. The problem is that by default connections from client are as latin1, =
db=20
is latin2 so servers needs to do conversion from latin2->latin1 which can't=
=20
be done and thus I'm getting '?' characters instead of latin2 characters.
The thing I need is how to force default latin2 in all client connections e=
ven=20
if client won't request latin2 by using set names.
Tried doing things like in mysqld.conf:
init-connect =3D SET @lchar =3D IF(@@session.character_set_client =3D _utf8=
"latin1",=20
@@global.character_set_client, @@session.character_set_client); SET=20
character_set_client =3D @lchar; SET character_set_results =3D @lchar; SET=
=20
character_set_connection =3D @lchar;
but that doesn't work unfortunately from init-connect (works from mysql=20
cmdline client) ;-(
=2D-=20
Arkadiusz Mi=B6kiewicz PLD/Linux Team
http://www.t17.ds.pwr.wroc.pl/~misiek/ http://ftp.pld-linux.org/