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
This article lists some tips and codes about form...
1. Open the virtual machine and git bash window a...
1. Background In the context of rapid updates and...
Table of contents What is ReactHook? React curren...
Services provided by NFS Mount: Enable the /usr/s...
When a web project gets bigger and bigger, its CS...
Vue3 project encapsulation side navigation text s...
nginx is our most commonly used server, often use...
Table of contents Interpolation Expressions metho...
This article describes how to configure a seconda...
1. One-stop solution 1. Problem analysis and loca...
This article example shares the specific code of ...
Original configuration: http { ...... limit_conn_...
1. Normal background blur Code: <Style> htm...
letter-spacing property : Increase or decrease th...