2017-03-14 115 views
0

我有一个MySQL泊坞窗文件,如下所示:MYSQL搬运工文件

docker build --build-arg http_proxy=<value> --build-arg https_proxy=<value> -f mySQL_Dockerfile -t mysql . 

每当我跑泊坞窗文件,它给了我:

FROM mysql:latest 

ENV MYSQL_ROOT_PASSWORD password 
ENV MYSQL_DATABASE database 
ENV MYSQL_USER root 
ENV MYSQL_PASSWORD mysql007 
ENV COMPOSE_CONVERT_WINDOWS_PATHS 1 

COPY init.sql /docker-entrypoint-initdb.d/ 

RUN chmod a+x /docker-entrypoint-initdb.d/init.sql && chown root:root  /docker-entrypoint-initdb.d/init.sql 

EXPOSE 3306 
CMD ["mysqld"] 

我使用泊坞窗终端上使用以下命令建立文件以下日志并退出:

Initializing database 
2017-03-14T08:58:57.139375Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2017-03-14T08:58:57.538155Z 0 [Warning] InnoDB: New log files created, LSN=45790 
2017-03-14T08:58:57.667334Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 
2017-03-14T08:58:57.726216Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 757aecb4-0894-11e7-9b9f-0242 
ac110002. 
2017-03-14T08:58:57.729630Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 
2017-03-14T08:58:57.732463Z 1 [Warning] [email protected] is created with an empty password ! Please consider switching off the --initialize-insecure option. 
2017-03-14T08:59:02.299741Z 1 [Warning] 'user' entry '[email protected]' ignored in --skip-name-resolve mode. 
2017-03-14T08:59:02.299874Z 1 [Warning] 'user' entry '[email protected]' ignored in --skip-name-resolve mode. 
2017-03-14T08:59:02.299916Z 1 [Warning] 'db' entry 'sys [email protected]' ignored in --skip-name-resolve mode. 
2017-03-14T08:59:02.299950Z 1 [Warning] 'proxies_priv' entry '@ [email protected]' ignored in --skip-name-resolve mode. 
2017-03-14T08:59:02.300070Z 1 [Warning] 'tables_priv' entry 'sys_config [email protected]' ignored in --skip-name-resolve mode. 
Database initialized 
Initializing certificates 
Generating a 2048 bit RSA private key 
.....+++ 
.......................................+++ 
unable to write 'random state' 
writing new private key to 'ca-key.pem' 
----- 
Generating a 2048 bit RSA private key 
...............+++ 
..........+++ 
unable to write 'random state' 
writing new private key to 'server-key.pem' 
----- 
Generating a 2048 bit RSA private key 
..............................+++ 
............+++ 
unable to write 'random state' 
writing new private key to 'client-key.pem' 
----- 
Certificates initialized 
MySQL init process in progress... 
2017-03-14T08:59:05.114256Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 
2017-03-14T08:59:05.118407Z 0 [Note] mysqld (mysqld 5.7.17) starting as process 77 ... 
2017-03-14T08:59:05.121736Z 0 [Note] InnoDB: PUNCH HOLE support available 
2017-03-14T08:59:05.121870Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 
2017-03-14T08:59:05.121904Z 0 [Note] InnoDB: Uses event mutexes 
2017-03-14T08:59:05.121942Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier 
2017-03-14T08:59:05.121958Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 
2017-03-14T08:59:05.121974Z 0 [Note] InnoDB: Using Linux native AIO 
2017-03-14T08:59:05.122514Z 0 [Note] InnoDB: Number of pools: 1 
2017-03-14T08:59:05.122715Z 0 [Note] InnoDB: Using CPU crc32 instructions 
2017-03-14T08:59:05.124223Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 
2017-03-14T08:59:05.135947Z 0 [Note] InnoDB: Completed initialization of buffer pool 
2017-03-14T08:59:05.137985Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). 
2017-03-14T08:59:05.150094Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 
2017-03-14T08:59:05.161065Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 
2017-03-14T08:59:05.161215Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 
2017-03-14T08:59:05.337319Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. 
2017-03-14T08:59:05.341242Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 
2017-03-14T08:59:05.341492Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 
2017-03-14T08:59:05.345441Z 0 [Note] InnoDB: Waiting for purge to start 
2017-03-14T08:59:05.395911Z 0 [Note] InnoDB: 5.7.17 started; log sequence number 2534561 
2017-03-14T08:59:05.397917Z 0 [Note] Plugin 'FEDERATED' is disabled. 
2017-03-14T08:59:05.405692Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool 
2017-03-14T08:59:05.431196Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. 
2017-03-14T08:59:05.431990Z 0 [Warning] CA certificate ca.pem is self signed. 
2017-03-14T08:59:05.434311Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170314 8:59:05 
2017-03-14T08:59:05.444568Z 0 [Warning] 'user' entry '[email protected]' ignored in --skip-name-resolve mode. 
2017-03-14T08:59:05.444699Z 0 [Warning] 'user' entry '[email protected]' ignored in --skip-name-resolve mode. 
2017-03-14T08:59:05.444743Z 0 [Warning] 'db' entry 'sys [email protected]' ignored in --skip-name-resolve mode. 
2017-03-14T08:59:05.444773Z 0 [Warning] 'proxies_priv' entry '@ [email protected]' ignored in --skip-name-resolve mode. 
2017-03-14T08:59:05.446269Z 0 [Warning] 'tables_priv' entry 'sys_config [email protected]' ignored in --skip-name-resolve mode. 
2017-03-14T08:59:05.451149Z 0 [Note] Event Scheduler: Loaded 0 events 
2017-03-14T08:59:05.451397Z 0 [Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-parti 
tion-engine-check' to skip this check. 
2017-03-14T08:59:05.451433Z 0 [Note] Beginning of list of non-natively partitioned tables 
2017-03-14T08:59:05.460184Z 0 [Note] End of list of non-natively partitioned tables 
2017-03-14T08:59:05.460451Z 0 [Note] mysqld: ready for connections. 
Version: '5.7.17' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server (GPL) 
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it. 
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it. 
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it. 
2017-03-14T08:59:08.290703Z 5 [Warning] 'user' entry '[email protected]' ignored in --skip-name-resolve mode. 
2017-03-14T08:59:08.290960Z 5 [Warning] 'user' entry '[email protected]' ignored in --skip-name-resolve mode. 
2017-03-14T08:59:08.291016Z 5 [Warning] 'db' entry 'sys [email protected]' ignored in --skip-name-resolve mode. 
2017-03-14T08:59:08.291115Z 5 [Warning] 'proxies_priv' entry '@ [email protected]' ignored in --skip-name-resolve mode. 
2017-03-14T08:59:08.291157Z 5 [Warning] 'tables_priv' entry 'sys_config [email protected]' ignored in --skip-name-resolve mode. 
mysql: [Warning] Using a password on the command line interface can be insecure. 
mysql: [Warning] Using a password on the command line interface can be insecure. 
ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for 'root'@'%' 

任何想法,问题可能是什么?它说root用户创建失败并退出!

谢谢。

回答

0

我遇到了同样的问题,解决方法是容易的,如果你想使用root为您的用户,只需设置MYSQL_ROOT_PASSWORD,不设置MYSQL_PASSWORD,结账this post

+0

似乎没有为我工作。 :( – Karthik

0

原来的答案有效,但在不同版本的mysql映像上。它似乎并不适用于mysql:最新的。我更改为mysql:5.7和建议的解决方案工作得很好。