How to change the connection collation of Mysql

后端 未结 2 1132
走了就别回头了
走了就别回头了 2021-02-13 04:19

How can I change connection collation of mysql database?

I am using Mysql workbench 5.5 and mysql 5.5 in ubuntu 14.

When I execute a stored procedure, an error o

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-13 04:48

    Look into your my.cnf, find the contents below near collation_server:

    [mysqld]
    init_connect='SET collation_connection = utf8_unicode_ci'
    init_connect='SET NAMES utf8'
    character-set-server=utf8
    collation-server=utf8_unicode_ci 
    skip-character-set-client-handshake
    

    Then change your collation variables to:

    collation_connection    utf8_unicode_ci
    collation_server        latin1_swedish_ci
    

    Remember to restart MySQL server service.

    For DB collation, you can use the following SQL:

    ALTER DATABASE  CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    

    or you can do it at Alter database screen in MySQL Workbench (always update this to the latest version!)

提交回复
热议问题