Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The solution of Chinese garbled Code of inserting Table data in mysql

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you the solution to the Chinese garbled code of table data inserted in mysql, I believe that most people do not know much about it, so share this article for your reference. I hope you will gain a lot after reading this article. Let's learn about it together.

The solution to inserting table data garbled in mysql: 1. Check whether the default encoding method of the local mysql installation file directory is utf8;2, start the mysql service, enter the relevant command to change the character set encoding of the default database table to utf8;3, and restart the service.

The operating environment of this tutorial: windows7 system, mysql8.0.22 version, DELL G3 computer.

The solution to the Chinese garbled code of table data inserted in mysql:

1. Check the my.ini configuration file under the local mysql installation file directory, and whether the default encoding mode of the server and client is utf8.

[mysqld] # the character set used by the server defaults to UTF8character-set-server=utf8 [client] # sets the default port default-character-set=utf8 for mysql clients to connect to the server

2. After the previous step is correct, open the command line and type: net start mysql to start the mysql service

After displaying "Service has started successfully", enter the command "mysql" to use the database

View the character set encoding format of the database table: enter the command "show create table test.xtt_test_copy;"

As shown in the figure above, it is found that the default is "latin1" and not "utf8". You need to continue to modify it manually. Enter the command "ALTER TABLE test.xtt_test_copy CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;" and continue to enter the command "show create table test.xtt_test_copy;" to see that the character set encoding of the default database table has been changed to "utf8".

View the character set encoding format of the database: enter the command "show creat database test;"

As shown in the figure above, it is found that the default is "latin1" rather than "utf8". You need to continue to modify it manually. Enter the command "ALTER DATABASE test DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;", continue to enter the command "SHOW CREATE database test;", and check that the character set encoding of the default database table has been changed to "utf8".

3. Finally, restart the service.

Mysql > net stop mysql;mysql > net start mysql; above are all the contents of this article entitled "the solution to Chinese garbled in table data in mysql". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report