1, find the my.cnf
[root@Sliver-Code ~]# vi /etc/my.cnf
Add the following three lines of statements
[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
2, restart the database
[root@Sliver-Code ~]# systemctl restart mariadb
3, verify that the modification
MariaDB [(none)]> SHOW VARIABLES LIKE '%colla%';
+----------------------+-----------------+
| Variable_name | Value |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+----------------------+-----------------+
Editing, re-insert on time, it is not a question mark.
4、
insert into employee values (1,1001, 'John Doe', 26, 'M', 'Haidian District, Beijing');
INSERT INTO the Employee values (2,1002, 'John Doe', 24, 'female', 'Beijing Changping District ');
INSERT INTO the Employee values (3,1003,' Wang five ', 25,' M ',' Changsha ');
INSERT INTO the Employee values (4,1004,' Aric ', 15' M ',' England ');
MariaDB [demochar]> SELECT * from Employee;
+ ------ + ----- + + -------- + ----- ----- ----- + + ---------------
| NUM | D_ID | name | Age | Sex | homeaddr |
+ ----- + ------ + ------- - + ----- + ----- + -------------------- +
| 1 | 1001 | Joe Smith | 26 | M | Haidian zone |
| 2 | 1002 | John Doe | 24 | F | Changping District, Beijing |
| 3 | 1003 | Wang Wu | 25 | M | Changsha, Hunan |
| 4 | 1004 | Aric | 15 | M | England |
+ ----- + ------ + -------- + ----- + ----- + ---------------- ---- +
Note that it may be necessary to re-build the table and library, because I saw the original table or ????.