1.) When we are tring to take the back and restore using different mysql versions then we will come across the issue. sometimes the error message shows different way
2.) when we try to updated the records connecting to different mysql using different client version
then this type of issue occurs
There are two ways to solve the problem.
1.) setting the session variables as follows:
set @@session.collation_connection='latin1_swedish_ci'
2.) changes in the config file as follows:
The simplest way would be to add a line to the [client] section of your config file:
default-caracter-set=latin1;
The different collations and characters are as follows for different version.
##########################mysql version 5.0 #############################
mysql> select version();
+------------+
| version() |
+------------+
| 5.0.77-log |
+------------+
1 row in set (0.15 sec)
mysql> show variables like '%coll%';
+----------------------+-------------------+
| Variable_name | Value |
+----------------------+-------------------+
| collation_connection | latin1_swedish_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
+----------------------+-------------------+
3 rows in set (0.00 sec)
mysql> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.01 sec)
###################################mysql 5.5.11 version ##################3
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.5.11 |
+-----------+
1 row in set (0.00 sec)
mysql> show variables like '%colla%';
+----------------------+-------------------+
| Variable_name | Value |
+----------------------+-------------------+
| collation_connection | utf8_general_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
+----------------------+-------------------+
3 rows in set (0.00 sec)
mysql> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
For more details about the collation and character set the url is as follows:
http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html
2.) when we try to updated the records connecting to different mysql using different client version
then this type of issue occurs
There are two ways to solve the problem.
1.) setting the session variables as follows:
set @@session.collation_connection='latin1_swedish_ci'
2.) changes in the config file as follows:
The simplest way would be to add a line to the [client] section of your config file:
default-caracter-set=latin1;
The different collations and characters are as follows for different version.
##########################mysql version 5.0 #############################
mysql> select version();
+------------+
| version() |
+------------+
| 5.0.77-log |
+------------+
1 row in set (0.15 sec)
mysql> show variables like '%coll%';
+----------------------+-------------------+
| Variable_name | Value |
+----------------------+-------------------+
| collation_connection | latin1_swedish_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
+----------------------+-------------------+
3 rows in set (0.00 sec)
mysql> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.01 sec)
###################################mysql 5.5.11 version ##################3
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.5.11 |
+-----------+
1 row in set (0.00 sec)
mysql> show variables like '%colla%';
+----------------------+-------------------+
| Variable_name | Value |
+----------------------+-------------------+
| collation_connection | utf8_general_ci |
| collation_database | latin1_swedish_ci |
| collation_server | latin1_swedish_ci |
+----------------------+-------------------+
3 rows in set (0.00 sec)
mysql> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
For more details about the collation and character set the url is as follows:
http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html

No comments:
Post a Comment