Japanese setting of mysql in Docker container

Introduction I'm a Rails beginner, but I want to develop with docker + mysql! I'm programming rails with docker. Through trial and error, Iloilo creates and erases docker containers, and repeatedly creates and erases them. (Insanely troublesome) Each time, I set the docker container in Japanese, so I tried to summarize it again.
  • If this setting is not made, Japanese will not be displayed correctly and will be ????.

  • Maybe there is an Iloilo method even if you don't do it each time ... I would appreciate it if you could teach me.

  • We refer to the following qiita as a whole. Thank you very much. https://qiita.com/maejima_f/items/4d5432aa471a9deaea7f

Enter the Docker container

$ docker exec -it container name bash

Check the locale settings in the container

root@XXXX :/# locale

It starts from changing the information of this locale to Japan and UTF-8. Before that, update the inside of the container or put vim and prepare.

root@XXXX :/# apt-get update
root@XXXX :/# apt-get install vim
  • Do you want to install both in the middle? Will appear, so enter y to continue.

After doing the two, make the following settings.

  1. Language setting
  • If you press enter several times, Locales to be generated: will appear. Enter Japanese 285. ja_JP.UTF-8 UTF-8 and press enter (285 is subject to change)
root@XXXX :/# dpkg-reconfigure locales


Locales are a framework to switch between multiple languages and allow users to use their language, country, characters, collation
order, etc.

Please choose which locales to generate. UTF-8 locales should be chosen by default, particularly for new installations. Other
character sets may be useful for backwards compatibility with older systems and software.

  1. All locales               125. el_GR ISO-8859-7               249. gl_ES ISO-8859-1           373. pl_PL ISO-8859-2
  2. aa_DJ ISO-8859-1          126. el_GR.UTF-8 UTF-8              250. gl_ES.UTF-8 UTF-8          374. pl_PL.UTF-8 UTF-8
  3. aa_DJ.UTF-8 UTF-8         127. el_GR@euro ISO-8859-7          251. gl_ES@euro ISO-8859-15     375. ps_AF UTF-8
  4. aa_ER UTF-8               128. en_AG UTF-8                    252. gu_IN UTF-8                376. pt_BR ISO-8859-1
  5. aa_ER@saaho UTF-8         129. en_AU ISO-8859-1               253. gv_GB ISO-8859-1           377. pt_BR.UTF-8 UTF-8
  6. aa_ET UTF-8               130. en_AU.UTF-8 UTF-8              254. gv_GB.UTF-8 UTF-8          378. pt_PT ISO-8859-1
  7. af_ZA ISO-8859-1          131. en_BW ISO-8859-1               255. ha_NG UTF-8                379. pt_PT.UTF-8 UTF-8
  8. af_ZA.UTF-8 UTF-8         132. en_BW.UTF-8 UTF-8              256. hak_TW UTF-8               380. pt_PT@euro ISO-8859-15
  9. agr_PE UTF-8              133. en_CA ISO-8859-1               257. he_IL ISO-8859-8           381. quz_PE UTF-8
  10. ak_GH UTF-8              134. en_CA.UTF-8 UTF-8              258. he_IL.UTF-8 UTF-8          382. raj_IN UTF-8
  11. am_ET UTF-8              135. en_DK ISO-8859-1               259. hi_IN UTF-8                383. ro_RO ISO-8859-2
  12. an_ES ISO-8859-15        136. en_DK.ISO-8859-15 ISO-8859-15  260. hif_FJ UTF-8               384. ro_RO.UTF-8 UTF-8
  13. an_ES.UTF-8 UTF-8        137. en_DK.UTF-8 UTF-8              261. hne_IN UTF-8               385. ru_RU ISO-8859-5


(Enter the items you want to select, separated by spaces.)

Locales to be generated: 285 #This is the current Japanese UTF-It is a setting number of 8.

  1. Time zone setting
  • First, select 6 Asia in the region selection, and then select
  • Select 79 Tokyo in the time zone selection
root@XXXX :/# dpkg-reconfigure tzdata

Please select the geographic area in which you live. Subsequent configuration questions will narrow this down by presenting a list of
cities, representing the time zones in which they are located.

  1. Africa   3. Antarctica  5. Arctic  7. Atlantic  9. Indian    11. SystemV  13. Etc
  2. America  4. Australia   6. Asia    8. Europe    10. Pacific  12. US
Geographic area: 6 #Select Asia

Please select the city or region corresponding to your time zone.

  1. Aden      14. Beirut      27. Gaza         40. Karachi       53. Muscat        66. Riyadh         79. Tokyo
  2. Almaty    15. Bishkek     28. Harbin       41. Kashgar       54. Nicosia       67. Sakhalin       80. Tomsk
  3. Amman     16. Brunei      29. Hebron       42. Kathmandu     55. Novokuznetsk  68. Samarkand      81. Ujung_Pandang
  4. Anadyr    17. Chita       30. Ho_Chi_Minh  43. Khandyga      56. Novosibirsk   69. Seoul          82. Ulaanbaatar
  5. Aqtau     18. Choibalsan  31. Hong_Kong    44. Kolkata       57. Omsk          70. Shanghai       83. Urumqi
  6. Aqtobe    19. Chongqing   32. Hovd         45. Krasnoyarsk   58. Oral          71. Singapore      84. Ust-Nera
  7. Ashgabat  20. Colombo     33. Irkutsk      46. Kuala_Lumpur  59. Phnom_Penh    72. Srednekolymsk  85. Vientiane
  8. Atyrau    21. Damascus    34. Istanbul     47. Kuching       60. Pontianak     73. Taipei         86. Vladivostok
  9. Baghdad   22. Dhaka       35. Jakarta      48. Kuwait        61. Pyongyang     74. Tashkent       87. Yakutsk
  10. Bahrain  23. Dili        36. Jayapura     49. Macau         62. Qatar         75. Tbilisi        88. Yangon
  11. Baku     24. Dubai       37. Jerusalem    50. Magadan       63. Qostanay      76. Tehran         89. Yekaterinburg
  12. Bangkok  25. Dushanbe    38. Kabul        51. Makassar      64. Qyzylorda     77. Tel_Aviv       90. Yerevan
  13. Barnaul  26. Famagusta   39. Kamchatka    52. Manila        65. Rangoon       78. Thimphu

Time zone: 79 #Select Tokyo

Set the environment variable LANG Edit .bashrc with the vim you just installed and Add export ...

How to edit with vim
vim ~ / .bashrc starts vim. Use the four-way controller to move to the bottom of the file and press "i" to enter input mode Add export ~ and press esc to return to command mode Type: wq to save your changes

root@XXXX :/# export LANG=ja_JP.UTF-8
root@XXXX :/# vim ~/.bashrc

Looking at the locale again

root@XXXX :/# locale

It has been changed!

Plus, let's create a file called .inputrc and add its contents.

root@XXXX :/# vim ~/.inputrc
#The following 3 lines.Add to inputrc
set convert-meta off
set meta-flag on
set output-meta on

root@XXXX :/# source ~/.inputrc

If you do the following, I think that the settings in mysql have also changed. that's all.

Recommended Posts

Japanese setting of mysql in Docker container
Japanese localization of Docker container of CentOS7 / CentOS8 and Japan time setting
MySQL container does not start in Docker
Setting the baseURL in the axios module of Docker environment Nuxt
Check MySQL logs in Docker environment
Summary of steps for developing in Docker container with VS Code
[Introduction] Setting up GridDB Community Edition in the CentOS container of Docker Desktop for the first time
Put Kanban in Docker of Raspberry Pi 3
Kind @ Mac in Docker and vctl container
The story of updating SonarQube's Docker Container
Edit Mysql with commands in Docker environment
Directly operate mariadb running in Docker container
[Docker] Start container, start bash in container, delete image
Run GUI application on Docker container (Japanese input)
How to check the logs in the Docker container
Self-hosting with Docker of AuteMuteUs in Windows environment
Setting to exit from Docker container with VScode
How to update pre-built files in docker container
[Rails5.2] Support for emoji of Mysql 5.7 in Docker (change character code to utf8mb4)
Edit Docker Container in VSCode multi-stage SSH Vagrant
Setting up Docker Engine in a non-internet connection
Small Docker container
Stumble in MySQL 5.5-> 5.7
Support out of support in docker environment using centos6
How Docker works ~ Implement the container in 60 lines
How to install Docker in the local environment of an existing Rails application [Rails 6 / MySQL 8]
Summary of frequently used commands in Rails and Docker
Use of Japanese fonts and external characters in JasperReport
SSL in the local environment of Docker / Rails / puma
Introduction of Docker --Part 1--
Japanese localization of Ubuntu20.04
Japanese localization of Eclipse
[Docker] Connection with MySQL
Docker container usage scene
Output in multiples of 3
Setting value of log4jdbc.properties
Copy and paste the file contents in Ubuntu's Docker container
Create a MySQL test environment (+ millions of test data) in 5 minutes
List of Docker commands that I often use (container operation)
Host specification when laravel php artisan serve in docker container
Install by specifying the version of Django in the Docker environment
Easy environment construction of MySQL and Redis with Docker and Alfred
Nginx container that displays the Hostname of the host running Docker
Create a MySQL container for application testing in Ansible AWX
Get only the ID of the container specified by docker ps
Put Redmine docker container in Raspberry Pi 4 Model B 2GB
Getting Started with GitHub Container Registry instead of Docker Hub
802.1X authentication to the network of Bonding setting in CentOS7