Change "Character" and "collation" settings

Asked

Viewed 1,106 times

3

I have a configuration in a database as follows:


SERVIDOR 1

show variables like '%version%';

innodb_version           1.1.8
protocol_version         10
slave_type_conversions  
version                  5.5.19-log
version_comment          MySQL Community Server (GPL) by Remi
version_compile_machine  x86_64
version_compile_os       Linux

show variables like '%character%';

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/

show variables like 'collation%';

collation_connection     utf8_general_ci
collation_database       latin1_swedish_ci
collation_server         latin1_swedish_ci

And on the other Server, set up as follows:

SERVIDOR 2

show variables like '%version%';

innodb_version           5.6.22
protocol_version         10
slave_type_conversions  
version                  5.6.22-log
version_comment          MySQL Community Server (GPL)
version_compile_machine  x86_64
version_compile_os       Win64

show variables like '%character%';

character_set_client     utf8
character_set_connection utf8
character_set_database   utf8
character_set_filesystem binary
character_set_results    utf8
character_set_server     utf8
character_set_system     utf8
character_sets_dir       C:\Program Files\MySQL\MySQL Server 5.6\share\charsets\

show variables like 'collation%';

collation_connection     utf8_general_ci
collation_database       utf8_general_ci
collation_server         utf8_general_ci

I need Server 2 to be identical to Server 1. Note that the configuration difference is in the following items:

character_set_database  (alterar para "latin1")
character_set_server    (alterar para "latin1")
collation_database      (alterar para "latin1_swedish_ci")
collation_server        (alterar para "latin1_swedish_ci")

I tried the "SET" commands, but it didn’t work, even by command line.

Is it possible to change? How to do?

I appreciate the help!

1 answer

1

That’s very simple, just change the Character and collate of your server 2 database:

ALTER DATABASE tua_Base_de_Dados DEFAULT CHARACTER SET latin1 COLLATE=latin1_swedish_ci;

And as you say in this answer add these lines into the file /etc/mysql/my.cnf

[mysqld]
character_set_database=latin1
character_set_server=latin1
  • [mysqld] character_set_database=latin1 character_set_server=latin1 .

  • Because I detected the same problem @mcardoso, I’m going to try to solve.

  • I haven’t been able to... any solution?

  • I’m also still trying to solve @mcardoso

Browser other questions tagged

You are not signed in. Login or sign up in order to post.