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
Mysql converts query result set into JSON data Pr...
Preface In the process of writing code, we will i...
1. Change the virtual machine hardware version in...
1. Regular expression matching ~ for case-sensiti...
Introduction Today I will share the use of the su...
Let’s take a look at what kind of charging animat...
Without further ado, let me show you the code. Th...
Linux finds a specific program where is The where...
What is Publish/Subscribe? Let me give you an exa...
View Database show databases; Create a database c...
1. Overview Group by means to group data accordin...
Start the centos8 virtual machine and press the u...
Preface: After studying the previous article, we ...
Preface I have been summarizing my front-end know...
Table of contents background accomplish 1. Encaps...