当前位置:网站首页>Solve the problem of garbled code in the MySQL execution SQL script database in docker (no need to rebuild the container)
Solve the problem of garbled code in the MySQL execution SQL script database in docker (no need to rebuild the container)
2022-06-13 05:19:00 【Puff o】
1. reason
docker Medium mysql The default encoding of the image conflicts with Chinese and English .
2. solve
Built container , No need to restart mysql
This method can only modify the code temporarily , Used to perform sql Script , The original code will be restored after the database is restarted .
- Get into mysql Containers
docker exec -it Containers ID bash - Sign in mysql
mysql -u user name -p password - Modify encoding
Execute the command one by one
set character_set_client=utf8;
set character_set_connection=utf8;
set character_set_database=utf8;
set character_set_results=utf8;
set character_set_server=utf8;
In execution sql The script can be .
Built container , Need to restart mysql
modify my.cnf Configuration file
- Get into mysql Containers
docker exec -it Containers ID bash - Modify the configuration file
vi /etc/mysql/my.cnf
There are differences in file locations It can be used find Command to find . - stay my.cnf Add
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8 - restart mysql that will do
/etc/rc.d/init.d/mysql restart
There are also differences in file locations use find Just search .
Container not built
For unbuilt containers , New on host my.cnf, Setup profile ( password , port , Coding, etc Baidu copy directly my.cnf The required configuration information ), When building the container, the host's my.cnf Hang on to docker Then you can .
边栏推荐
- C language learning log 1.2
- MySQL basic query
- Error: unmapped character encoding GBK
- Time display of the 12th Blue Bridge Cup
- Simple-SR:Best-Buddy GANs for Highly Detailed Image Super-Resolution论文浅析
- Chapter 13 abstraction: address space
- [multithreading] thread pool core class -threadpoolexecutor
- Std:: Map empty example
- C language learning log 2.19
- Solutions to conflicts between xampp and VMware port 443
猜你喜欢

System file interface open

Database design

Course outline of market drawing 1- basic knowledge

Ruoyi cloud startup tutorial (hand-held graphics)

Simple sr: Best Buddy Gans for highly detailed image super resolution Paper Analysis

Use of natural sorting comparable

lookup

Mysql database crud operation

Case - simulated landlords (primary version)

C language learning log 11.7
随机推荐
Listiterator list iterator
【多线程】线程池核心类-ThreadPoolExecutor
C language learning log 1.17
C language learning log 10.19
Chapter 17 free space management
C language learning log 1.24
Dynamic programming - longest common substring
C language learning log 10.10
Anaconda configuring the mirror source
Clause 30: be familiar with the failure of perfect forwarding
Case - the ArrayList collection stores student objects and traverses them in three ways
Problems encountered in the use of PgSQL
Clause 31: avoid default capture mode
How to Algorithm Evaluation Methods
metaRTC4.0集成ffmpeg编译
1.2 differences caused by keywords
BM1Z002FJ-EVK-001开机测评
File descriptorfile description
Understanding of speech signal framing
详解OpenCV的函数cv::add(),并附各种情况的示例代码和运行结果