basic situation:
System: CentOS 7
MariaDB installation: yum
Garbled resolution process:
(After logging database) 1. Review the current database encoding
# show variables like 'character%';
(The picture above shows success has been configured)
2. If the result you need to set the database configuration file to the map
• Edit /etc/my.cnf.d/client.cnf file, add the following
[client]
default-character-set=utf8
• Edit /etc/my.cnf.d/mysql-clients.cnf file, add the following
[mysql]
default-character-set=utf8
• Edit /etc/my.cnf file, add the following
[mysqld]
character-set-server=utf8
default-storage-engine=INNODB
• Restart Service
# systemctl restart mariadb
Run again # show variables like 'character%';
FIG As a result, the setup is successful.
But when the database was created before setting insert Chinese, still garbled. At this point you can delete re-create a database.