Get the App
SLTechnology News&Howtos  ›  Database  › 

The method of setting mysql coding format on the command line

Shulou Source: shulou.com Published: 2022-06-01 02:55:36 11月04日 Update

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.

Tags: Commands codes formats methods content data more patterns utf-8 login good practical consistent not enough garbled again customers ideas databases files Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Information NVidia MySQL Microsoft