Mysql – change character_set_connection utf8mb4 thesql

amazon ec2awsMySQL

I want to change character_set_connection utf8mb4. Its showing me utf8. I have follow this https://mathiasbynens.be/notes/mysql-utf8mb4 article and changed


[client]
default-character-set = utf8mb4

[mysql] default-character-set = utf8mb4

[mysqld] character-set-client-handshake = FALSE character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci

Also fire this query.

SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci

but when I check current status in phpmyadmin using

SHOW VARIABLES WHERE Variable_name LIKE 'character_set_%' OR Variable_name LIKE 'collation%';

result

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
collation_connection utf8_general_ci
collation_database latin1_swedish_ci
collation_server latin1_swedish_ci

I have set alter tables and database

SET NAMES utf8mb4;  
ALTER DATABASE openfire CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;  
ALTER TABLE ofOffline CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; 

This is my connections string

jdbc:mysql://localhost:3306/openfire?rewriteBatchedStatements=true&useUnicode=true

MySQL 5.6.33 I have check in windows with version 5.7.14 it's fine. Please give me any suggestions. Thanks in advance.

Best Answer

What client are you using? You will need to specify that the connection is to be with utf8mb4.

What about the tables? If you have existing tables, an ALTER ... CONVERT TO will be needed.