search

Home  >  Q&A  >  body text

There is no problem with mysql configuration, but Chinese is not displayed;

mysql> show variables like "%colla%";
---------------------- -----------------
| Variable_name        | Value           |
---------------------- -----------------
| collation_connection | utf8_general_ci |
| collation_database   | utf8_general_ci |
| collation_server     | utf8_general_ci |
---------------------- -----------------

mysql>  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       | C:\phpStudy\PHPTutorial\MySQL\share\charsets\ |
-------------------------- -----------------------------------------------

mysql> create table emp3(
    ->   `id` int(11) NOT NULL AUTO_INCREMENT,
    ->   `username` varchar(50) NOT NULL,
    ->   `balance` float NOT NULL,
    ->   `province` varchar(20) NOT NULL,
    ->   `age` tinyint(3) unsigned NOT NULL,
    ->   `sex` tinyint(4) NOT NULL,
    ->   PRIMARY KEY (`id`)
    -> ) ENGINE=InnoDB CHARSET=utf8;
Query OK, 0 rows affected (0.03 sec)

QQ图片20180827235422.png

吴勇文吴勇文2341 days ago1303

reply all(2)I'll reply

  • 天忆

    天忆2018-08-28 16:05:48

    Because the character encoding of the cmd command line is gbk, so what you insert is gbk encoded data, and your table is utf8 encoded, so the insertion will be garbled. You can try to build a gbk encoded data table and execute set names gbk;Then insert data into the command line

    reply
    0
  • 吴勇文

    Thank you very much, solved

    吴勇文 · 2018-08-28 23:26:01
  • Cancelreply