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

How to modify mysql Encoding to utf8

2025-04-06 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 "how to modify mysql code to utf8". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

How to modify mysql encoding to utf8: 1. Open and modify mysql configuration file "my.ini";2. Add "default-character-set = utf8" under "mysqld" label;3. Restart mysql service.

Operating environment of this tutorial: Windows 10 system, mysql version 8.0.22, Dell G3 computer.

How to modify mysql code to utf8

1. Edit MySql configuration file

MySql configuration file Windows generally in the system directory or MySql installation directory under the name my.ini, you can search, Linux is generally/etc/my.cnf

--Add the following under the [mysqld] label:

default-character-set = utf8character_set_server = utf8

Note: If something like "default-character-set=GBK" already exists under this label, just modify it.

--Add a line under the [mysql] tag

default-character-set = utf8

--Add a line under the [mysql.server] tag

default-character-set = utf8

--Add a line under the [mysqld_safe] label

default-character-set = utf8

--Add a line under the [client] label

default-character-set = utf8

Restart MySql service

Windows can be operated in Service Manager or from the command line:

net stop mysql Enter

net start mysql Enter

The service name may not necessarily be mysql, please press your own settings

Linux can be restarted with service mysql

If there is a startup failure, check the configuration file for setting errors

3. View the setting results

Login MySql Command Line Client: Open Command Line

mysql -uroot -p Enter

enter the password

After entering mysql, execute: show variables like "% character %";

In addition:

To create a database, you can use the following command:

create database app_relation character set utf8;use app_relation;source app_relation.sql;

The command to modify the database encoding is:

alter database app_relation character set utf8;"how to modify mysql encoding to utf8" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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