Change character and collation settings

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 another server, setup 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 did not work even with the command line.

Is it possible to change? How to do?

Thanks for the help!

    
asked by anonymous 11.12.2014 / 00:41

1 answer

1

This is very simple, just change the character and collate of your server database 2:

ALTER DATABASE tua_Base_de_Dados DEFAULT CHARACTER SET latin1 COLLATE=latin1_swedish_ci;

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

[mysqld]
character_set_database=latin1
character_set_server=latin1
    
11.12.2014 / 10:38