1.暂时修改
set names utf8
2.永久修改
mysqld下加
character_set_server = utf8
MariaDB [(none)]> show variables like ‘%char%‘;
+--------------------------+-------------------------------------------------------+
| Variable_name | Value |
+--------------------------+-------------------------------------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /var/soft/mariadb-5.5.50-linux-x86_64/share/charsets/ |
+--------------------------+-------------------------------------------------------+
client和mysql下加
default-character-set = utf8
MariaDB [(none)]> show variables like ‘%char%‘;
+--------------------------+-------------------------------------------------------+
| Variable_name | Value |
+--------------------------+-------------------------------------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /var/soft/mariadb-5.5.50-linux-x86_64/share/charsets/ |
+--------------------------+-------------------------------------------------------+
需要在mysqld下加上
skip-character-set-client-handshake
MariaDB [(none)]> show variables like ‘%char%‘;
+--------------------------+-------------------------------------------------------+
| Variable_name | Value |
+--------------------------+-------------------------------------------------------+
| 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 | /var/soft/mariadb-5.5.50-linux-x86_64/share/charsets/ |