MySQL UTF-8 garbled in DOS interface

First of all, make sure that your configuration is correct. There are a lot of related documents on the Internet, so I won't repeat them here.

Direct solution:

When we use the command line tool to connect to the database, change the encoding of the client (black window):

1. Set the character encoding of the client:
   set names gbk

2. Run the following SQL statement before querying

mysql> set character_set_results=gbk;或者mysql> set character_set_results=gb2312;

3. Under DOS environment, use "mysql --default_character_set=gbk -uroot -p***" to enter mysql~~~~

Guess you like

Origin blog.csdn.net/liushulin183/article/details/44925589