当前位置:网站首页>MySQL solves the problem of not supporting Chinese
MySQL solves the problem of not supporting Chinese
2022-07-25 10:19:00 【scwMason】
Premise
The environment is ubuntu Next
Method
1. Check it out. mysql Default character set

- character_set_client Code for the client ;
- character_set_connection The code used to establish the connection ;
- character_set_database Coding of database ;
- character_set_results The encoding of the result set ;
- character_set_server Database server code ;
2. Modify the configuration file
linux Under the system , modify MySQL The steps of database default coding are :
- modify
/etc/mysql/mysql.conf.d/mysqld.cnffile
xhost + # If xhost + Cannot perform , Report errors :xhost : unable to open display “”
sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf
- stay [mysqld ] The following add
# I'll change it to utf8mb4 It's because of storage emoji Expression error .
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
- modify mysql.cnf file
sudo gedit /etc/mysql/conf.d/mysql.cnf- stay [mysql] Add below
default-character-set = utf8mb4
3. restart mysql
sudo service mysql stop
sudo service mysql start4. View the changed encoding method

Okay , Setup complete , You can store data happily , It can be preserved emoji expression .
follow-up
If it is an existing table , You can check the character set supported by the table first
show create table entries2;Then modify the characters of the table according to the situation
alter table table_name convert to character set utf8mb4;
边栏推荐
猜你喜欢
随机推荐
Redis和MongoDB的区别
Common methods of JS digital thousand bit segmentation
Selenium waits for the occurrence of elements and the conditions under which the waiting operation can be performed
Common methods of nodejs version upgrade or switching
Bug分类和定级
Multithreading - five states
数论--约数研究
Mouse monitor, Paintbrush
Wechat applet jumps to other applets
一、unittest框架和pytest框架的区别
复现 ASVspoof 2021 baseline RawNet2
An ASP code that can return to the previous page and automatically refresh the page
鼠标监听,画笔
Use and principle of rest
Ansible部署指南
Principle of struct2
mysql 解决不支持中文的问题
UE4 快速找到打包失败的原因
Salt FAQs
Use of dictionary tree








