Summary:
This article will show you how to use Docker to create a MySQL container and use navicat to connect to the MySQL service, and finally provide a solution to the problem of Navicat Chinese garbled.
First, create a MySQL container under Docker 1, download the latest version of MySQL Image:
$ docker Pull MySQL
2. Start the MySQL container
Create MySQL config file my.cnf, full path to/DATA/MYSQL/CONF/MY.CNF, with the following contents:
[Mysqld]pid-file =/var/run/mysqld/mysqld.pidsocket =/var/run/mysqld/mysqld.sockdatadir =/var/lib/ Mysql#log-error =/var/log/mysql/error.log# By default we are only accept connections from localhost#bind-address = 127.0.0.1# disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0init_connect= ' SET collation_connection = Utf8_unicode_ci ' init_connect= ' SET NAMES UTF8 ' Character-set-server=utf8collation-server=utf8 _unicode_ciskip-character-set-client-handshake[client]default-character-set=utf8[mysql]default-character-set= Utf8
Start the container and execute the following command:
$ docker run-d-e mysql_root_password=1234563306:3306 MYSQL
Parameter description:
-D: Run as daemon-E: Specifies the root password-P: Bind 3306 port number, preceded by the host port of the Docker container--name: Specifies the container name-V: Mount the file. The above example hangs in two files, one is data file, one is config file my.cnf
3. Basic operation of MySQL under Docker
To enter the container command:
$ docker exec-it Seckill-mysql Bash
Stop/start MySQL:
$ docker Stop seckill-mysql$ Docker start Seckill-mysql
Second, install navicat for MYSQL1, download, install
Website:
Https://www.navicat.com/en/download/navicat-for-mysql
Extract:
tar zxvf navicat120_mysql_en_x64. tar. gz
Start Navicat:
$./start_navicat
2, solve the problem of MySQL Chinese garbled
Navicat startup, will generally encounter Chinese garbled problem, if there is this problem, you need to download the following Wen Quan Shu black font, and re-specify the encoding format.
PS: My method may not be the best solution, but after my own test, it will certainly work.
1, install Wen Quan shu black font
sudo Install
2, modify the encoding format in the Start_navicat file, consistent with the system
First look at the system encoding format:
$ locale
Lang=zh_cn. UTF-8
Then modify the Start_navicat:
$ vim Start_navicat
The export lang= "en_US. UTF-8 "changed to export lang=" ZH_CN. UTF-8 "
3. Modify NAVICAT Display encoding format
Find Tools-"options" in the menu ... See the following window:
The general, Editor, records three menu under the GUI font is changed to: Wenquanyi Zen Hei is black.
Through the above configuration, Chinese garbled problem is really solved!
Use Navicat to connect Docker mysql5.7.20 under ubuntu16.04