[MySQL] Mariadb character set

Mariadb character set

If you do not set the character set, you can view mariadb character set of the default setting is latin1.

The following command, view the default configuration Mariadb of:

[root@oradb ~]# /usr/local/mysql/bin/mysqld --verbose --help |grep character-set-server
2019-09-23 16:10:05 0 [Note] Plugin 'FEEDBACK' is disabled.
  -C, --character-set-server=name 
character-set-server                                       latin1

Mariadb modify the character set utf8, unified international standards, configuration is as follows:

[root@oradb ~]# vi /etc/my.cnf 
[mysqld]
datadir=/u01/data/
socket=/tmp/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server = utf8

[mysqld_safe]
log-error=/u01/data/mysqld.log
pid-file=/tmp/mysqld.pid

Restart the service, as follows:

[root@oradb ~]# service mysqld restart

Eventually, the unified server utf8, as follows:

[root@oradb ~]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.3.18-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show variables like '%character%';
+--------------------------+----------------------------------+
| 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       | /usr/local/mysql/share/charsets/ |
+--------------------------+----------------------------------+
8 rows in set (0.001 sec)

Guess you like

Origin www.cnblogs.com/zhangshengdong/p/11724990.html