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

Mysql coding setting method under Windows and Linux system

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

Share

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

This article introduces the relevant knowledge of "mysql coding setting method under Windows and Linux system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Method 1

How to manually modify the default coding of versions above mysql4.1

Use the 5+MySQL 4.1.x/5.x environment:

Importing mysql4 into mysql5 is prone to Chinese garbled, so you need to make the following settings first:

It is assumed that mysql is installed in the c:/mysql directory

1: start-run, enter cmd and press enter

2: enter cd c:/mysql/bin and press enter

3: enter mysql-- default-character-set=gbk-u root-p and press enter

Next, you will be prompted for a password, enter it, press enter, and finally restart mysql

Note: gbk stands for simplified Chinese used by Chinese mainland

Method 2

Settings for MySQL default character encoding

The default encoding of MySQL is Latin1, and Chinese is not supported. How to modify the default encoding of MySQL? let's take UTF-8 as an example.

It should be noted that there are a lot of changes to be made, and there are also many ways to modify them. Here is one of the simplest and most thorough ways:

1. Windows

1. Abort MySQL service

2. Find my.ini in the installation directory of MySQL. If not, copy my-medium.ini to a my.ini.

3. After opening my.ini, add default-character-set=utf8 under [client] and [mysqld], save and close

4. Start the MySQL service

II.

1. Abort MySQL service (bin/admin-u root shutdown)

2. Find my.cnf under / etc/. If not, copy the my-medium.cnf under the support-files directory under MySQL's installation directory to / etc/ and rename it to my.cnf.

3. After opening my.cnf, add default-character-set=utf8 under [client] and [mysqld], save and close

4. Start the MySQL service (bin/mysqld_safe &)

This is the end of the content of "mysql coding setting method under Windows and Linux system". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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