Preface: One day, I built a MySQL service in Docker and found that I could not enter Chinese characters in the MySQL command line. Chinese characters were also replaced by ?. I initially thought it was a problem with the MySQL character set. After checking, the problem was not solved. I exited the container terminal and found that I could not enter Chinese characters either. I inferred that there was a problem with the system character set. The solution process is recorded as follows: Before resolution: # Enter the container to view the character set [root@master2 ~]# docker exec -it b18f56aa1e15 /bin/bash root@b18f56aa1e15:/# locale LANG= LANGUAGE= LC_CTYPE="POSIX" LC_NUMERIC="POSIX" LC_TIME="POSIX" LC_COLLATE="POSIX" LC_MONETARY="POSIX" LC_MESSAGES="POSIX" LC_PAPER="POSIX" LC_NAME="POSIX" LC_ADDRESS="POSIX" LC_TELEPHONE="POSIX" LC_MEASUREMENT="POSIX" LC_IDENTIFICATION="POSIX" LC_ALL= # View the character sets supported by the container root@b18f56aa1e15:/# locale -a C C.UTF-8 POSIX Cannot input Chinese characters: The system uses the POSIX character set, which does not support Chinese characters, while C.UTF-8 does. The problem can be solved by changing the system's environment LANG to "C.UTF-8" format. Just enter the container like this to input Chinese: [root@master2 ~]# docker exec -it b18f56aa1e15 env LANG=C.UTF-8 /bin/bash root@b18f56aa1e15:/# Helloroot@b18f56aa1e15:/# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 80 Server version: 5.7.17-log MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> Hello Notice: This modification is only temporary. To make the change permanent, you need to set it in the Dockerfile when you create the container. The above is the details of how Docker solves the problem of being unable to input Chinese characters in the terminal. For more information about Docker solving the problem of being unable to input Chinese characters, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: JQuery implements hiding and displaying animation effects
>>: How to set process.env.NODE_ENV production environment mode
When installing in MySQL 8.0.16, some errors may ...
This article example shares the specific code of ...
1. Command Introduction The cal (calendar) comman...
Large Text Data Types in Oracle Clob long text ty...
1. Introduction to nmon Nmon (Nigel's Monitor...
This article records the installation graphic tut...
Today I used docker to pull the image, but the sp...
Displaying and interpreting information about you...
From development to deployment, do it yourself Wh...
background A new server was added in the company,...
1. What are the formats of lines? You can see you...
background In order to support Docker containeriz...
In fact many people will say “I’ve seen that table...
sed is a character stream editor under Unix, that...
Passing values between mini program pages Good ...