After resetting the system, the MySQL database that I installed a long time ago had garbled Chinese characters in the console query. It has been so long that I have no idea how to set it up. I searched a lot online and tried various settings, but after restarting the database, the Chinese characters are still garbled. Maybe I searched in the wrong way, but luckily I solved it in the end. I’ll open a blog to record it: Open the my.ini file in the installation directory Mine is: C:\Program Files\MySQL\MySQL Server 5.5, modified as follows: [client] default-character-set=utf8 port=3306 [mysql] #Many answers on the internet also set this gbk to utf8, but the result is garbled characters default-character-set=gbk #SERVER SECTION # ---------------------------------------------------------------------- ## The following options will be read by the MySQL Server. Make sure that # you have installed the server correctly (see above) so it reads this # file. # [mysqld]# The TCP/IP Port the MySQL Server will listen on port=3306 #Path to installation directory. All paths are usually resolved relative to this. basedir="C:/Program Files/MySQL/MySQL Server 5.5/" #Path to the database root datadir="C:/ProgramData/MySQL/MySQL Server 5.5/Data/" # The default character set that will be used when a new schema or table is # created and no character set is defined character-set-server=utf8 collation-server=utf8_general_ci After the modification is completed, restart mysql and check the code: mysql> show variables like 'character_set%'; +--------------------------+---------------------------------------------------------+| Variable_name | Value | +--------------------------+---------------------------------------------------------+| character_set_client | gbk || character_set_connection | gbk || character_set_database | utf8 || character_set_filesystem | binary || character_set_results | gbk || character_set_server | utf8 || character_set_system | utf8 || character_sets_dir | C:\Program Files\MySQL\MySQL Server 5.5\share\charsets\ | +--------------------------+---------------------------------------------------------+ Try it: mysql> insert into per values('garbled code solution'); Query OK, 1 row affected (0.00 sec) mysql> select * from per; +--------------+| name | +--------------+| From|| Garbled code solution | +--------------+ 3 rows in set (0.00 sec) Summarize The above is what I introduced to you about solving the Chinese garbled code problem of the MySQL5.5 database command line under Windows10. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: In-depth analysis of the Linux kernel macro container_of
>>: Detailed explanation of the usage of the alias command under Linux
1. Business Background Using a mask layer to shie...
Table of contents 1. Create a socket 2. Bind sock...
Table of contents 1. MySQL join buffer 2. JoinBuf...
This article records the method of sharing files ...
1. Background The following two problems are enco...
Table of contents Basic HTML structure Generate s...
In many cases, arrays are often used when writing...
Event loop in js Because JavaScript is single-thr...
Currently, layui officials have not provided the ...
1. Introduction Nginx is a free, open source, hig...
1. After installing MySQL 5.6, it cannot be enabl...
Table of contents Stabilization Throttling Summar...
Preparation: 1. Install VMware workstation softwa...
This article refers to the work of 51CTO blog aut...
(1) Each HTML tag has an attribute style, which c...