当前位置:网站首页>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;
边栏推荐
猜你喜欢
随机推荐
ES6 detailed explanation
Common methods of JS digital thousand bit segmentation
Exception handling exception
贪吃蛇小游戏
Small knowledge of common classes
CentOS install redis
VLAN的配置及其应用(以华为eNSP为例)
Output stream in io stream
UE4 LoadingScreen动态加载启动动画
CentOs安装redis
Selenium 等待元素出现与等待操作可以执行的条件
Wechat applet jumps to other applets
将 conda 虚拟环境 env 加入 jupyter kernel
An ASP code that can return to the previous page and automatically refresh the page
Filter filter details (listeners and their applications)
文件的上传功能
VSCode Latex Workshop 设置 XeLatex 编译
多线程——Runnable接口,龟兔赛跑
多线程——五大状态
Multithreading deadlock and synchronized









