mysql import data Chinese garbled_ubuntu

1. Part of the encoding format of mysql in ubuntu is not utf-8, so there will be Chinese garbled characters when importing files. The encoding format in Windows is gbk, so the encoding method of mysql should be modified to utf-8.

2. View the MySQL encoding format:

  a. Enter MySQL

  b. Enter

1 show variables like%chart%‘;

3. Modify the encoding method (permanent):

  Enter Terminal:

import: sudo vi / etc / mysql / my.cnfor 
          sudo vi /etc/mysql/conf.d/mysql.cnf ( mysql5.7.16 and later ) _ _
          Note: The location of the configuration file is different due to different versions
b. Add:
    [mysql]
    default-character-set=utf8
    [client]
    default-character-set=utf8
    [mysqld]
    character-set-server=utf8
c. Restart the mysql service:
    service mysql stop
    service mysql start

####Newbie, please correct me

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325476259&siteId=291194637