当前位置:网站首页>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;
边栏推荐
- 多线程——Callable接口,lambda
- Summary of most consistency problems
- GUI window
- VSCode Latex Workshop 设置 XeLatex 编译
- Swing的组件图标
- Selenium 等待元素出现与等待操作可以执行的条件
- 修改mysql的分组报错Expression #1 of SELECT list is not in GROUP
- Radio and multi selection buttons of swing components
- Attention is all you need 论文精读笔记 Transformer
- ROS distributed operation -- launch file starts nodes on multiple machines
猜你喜欢
随机推荐
史上最全面的UE4 文件操作,打开,读、写,增、删、改、查
Record some JS tool functions
Nodejs initial experience
【无标题】
1、 Initial mysql, MySQL installation, environment configuration, initialization
Pow(x,n)
Detailed explanation of MySQL database
四、TestFixture测试夹具,或者测试固件
File upload function
一文学会,三款黑客必备的抓包工具教学
NPM details
Swing组件
Probabilistic robot learning notes Chapter 2
@Import, conditional and @importresource annotations
Copy the old project into a web project
IDEA整体字体大小修改
CentOS install redis
Output stream in io stream
UE4 框架介绍
鼠标监听,画笔







