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 method of setting mysql coding format on the command line

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to set the mysql encoding format on the command line. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

The method of setting the mysql coding format on the command line is as follows: 1, log in to mysql on the command line and enter the mysql command line editing mode; 2, use the SET command to set the mysql coding format, syntax "set character_set_..=utf8".

Problem description: Chinese garbled when inserting data into mysql using JDBC. Display)

Solution: every java file and encoding in eclipse and eclipse must be set to utf8, which is consistent with the mysql database. Note: it is not enough to set mysql to utf-8 only when installing and building tables.

1. Log in to mysql

Go to the bin directory under the mysql installation path under the command line, and enter the mysql command line editing mode

2. SHOW VARIABLES LIKE 'character_set_%' to view the encoding formats

3. Use the SET command to change the format that is not utf-8 to utf-8 in turn

Set character_set_client=utf8; / / set the client's encoding to utf8

Set character_set_connection=utf8; / /

Set character_set_database=utf8; / /

Set character_set_results=utf8; / /

Set character_set_server=utf8; / /

Set character_set_system=utf8; / /

4. SHOW VARIABLES LIKE 'character_set_%'; check again for confirmation.

5. Finally, exit; is completed.

Thank you for reading! The method of setting mysql coding format on the command line is shared here. I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

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