gpt4 book ai didi

docker - MYSQL docker文件

转载 作者:行者123 更新时间:2023-12-02 20:49:39 24 4
gpt4 key购买 nike

我有一个mysql docker文件,如下所示:

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"]

我在docker终端上使用以下命令构建文件:
docker build --build-arg http_proxy=<value> --build-arg https_proxy=<value> -f mySQL_Dockerfile -t mysql .

每当我运行docker文件时,它都会给我以下日志并退出:
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] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2017-03-14T08:59:02.299741Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:02.299874Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:02.299916Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:02.299950Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:02.300070Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' 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 'root@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:05.444699Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:05.444743Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:05.444773Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:05.446269Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' 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 'root@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:08.290960Z 5 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:08.291016Z 5 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:08.291115Z 5 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
2017-03-14T08:59:08.291157Z 5 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' 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'@'%'

知道可能是什么问题吗?它说根用户创建失败并退出!

谢谢。

最佳答案

原来建议的答案有效,但是在不同版本的mysql镜像上。它似乎不适用于 mysql:latest 。我更改为 mysql:5.7 ,建议的解决方案工作正常。

关于docker - MYSQL docker文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42781733/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com