Home >Operation and Maintenance >Linux Operation and Maintenance >How to modify the encoding of mysql in linux

How to modify the encoding of mysql in linux

藏色散人
藏色散人Original
2021-11-29 14:06:163921browse

How to modify mysql encoding in Linux: 1. Check the mysql character set; 2. Modify the encoding of the mysql server through "default-character-set=utf8"; 3. Restart the mysql service.

How to modify the encoding of mysql in linux

The operating environment of this article: linux5.9.8 system, mysql5.5, Dell G3.

System: Alibaba Cloud

1. View mysql character set

Input: show variables like 'character_set_%';

2. Modify the encoding of a certain database

Input: alter database dbname default character set utf8;

3. Modify the encoding of the mysql server

Input :vi /etc/my.cnf

Add the following code in the yellow area:

default-character-set=utf8
[client]
default-character-set=utf8

4. Restart the mysql service

Enter: service mysqld restart

5. Check again

Input: show variables like 'character_set_%';

## Recommended study: "

mysql video tutorial

The above is the detailed content of How to modify the encoding of mysql in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn