Home>Article>Operation and Maintenance> What to do if mysql is garbled in docker

What to do if mysql is garbled in docker

藏色散人
藏色散人 Original
2022-10-21 14:20:39 2262browse

Solution to mysql garbled code in docker: 1. Create two directories, namely "/tmp/mysql/data" and "/tmp/mysql/conf"; 2. Write the "hmy.cnf" file ; 3. Create the container; 4. Use "docker ps -a" to check whether the creation is successful; 5. Enter the mysql container; 6. Test the connection successfully.

What to do if mysql is garbled in docker

The operating environment of this tutorial: linux7.3 system, docker version 19.03, Dell G3 computer.

What should I do if mysql is garbled in docker?

Solution to the Chinese garbled code of MySQL running in Docker

1. First create two directories

mkdir /tmp/mysql/data mkdir /tmp/mysql/conf

2. Write the hmy.cnf file and write the following content to In the file

[mysqld] skip-name-resolve character_set_server=utf8 datadir=/var/lib/mysql server-id=1000 [mysql] default-character-set = utf8 [mysql.server] default-character-set = utf8 [mysqld_safe] default-character-set = utf8 [client] default-character-set = utf8 vi /hmy.cnf

3. Create the container

What to do if mysql is garbled in docker

4. Check that the creation is successful

docker ps -a

What to do if mysql is garbled in docker

5 , enter the mysql container

docker exec -it mysql2 /bin/bash

What to do if mysql is garbled in docker

6. Test connection is successful

What to do if mysql is garbled in docker

7. Check whether there are any Chinese garbled characters

What to do if mysql is garbled in docker

Recommended learning: "docker video tutorial"

The above is the detailed content of What to do if mysql is garbled in docker. 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