• Docker - MySQL Database is uninitialized and password option is not specified


    问题描述

    docker run --name=master -p 3306:3306 -d mysql
    1. 2022-11-11 08:03:05+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.31-1.el8 started.
    2. 2022-11-11 08:03:05+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
    3. 2022-11-11 08:03:05+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.31-1.el8 started.
    4. 2022-11-11 08:03:05+00:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
    5. You need to specify one of the following as an environment variable:
    6. - MYSQL_ROOT_PASSWORD
    7. - MYSQL_ALLOW_EMPTY_PASSWORD
    8. - MYSQL_RANDOM_ROOT_PASSWORD

    原因分析

    启动时候没有配置环境变量密码

    解决方案

    docker run --name=master -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql
    • 如果用的是 GUI 界面,可以在环境变量那边配置 KV
    • 启动成功结果如下日志
    1. 2022-11-11 08:04:29+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.31-1.el8 started.
    2. 2022-11-11 08:04:29+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
    3. 2022-11-11 08:04:29+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.31-1.el8 started.
    4. 2022-11-11 08:04:29+00:00 [Note] [Entrypoint]: Initializing database files
    5. 2022-11-11T08:04:29.772339Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    6. 2022-11-11T08:04:29.772424Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.31) initializing of server in progress as process 80
    7. 2022-11-11T08:04:29.777358Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    8. 2022-11-11T08:04:33.614888Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
    9. 2022-11-11T08:04:37.621895Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
    10. 2022-11-11 08:04:41+00:00 [Note] [Entrypoint]: Database files initialized
    11. 2022-11-11 08:04:41+00:00 [Note] [Entrypoint]: Starting temporary server
    12. 2022-11-11T08:04:42.321690Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    13. 2022-11-11T08:04:42.341394Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 131
    14. 2022-11-11T08:04:42.401390Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    15. 2022-11-11T08:04:45.844897Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
    16. 2022-11-11T08:04:46.575024Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
    17. 2022-11-11T08:04:46.575058Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
    18. 2022-11-11T08:04:46.575741Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
    19. 2022-11-11T08:04:46.584621Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
    20. 2022-11-11T08:04:46.584640Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server - GPL.
    21. 2022-11-11 08:04:46+00:00 [Note] [Entrypoint]: Temporary server started.
    22. '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
    23. Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
    24. Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
    25. Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
    26. Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
    27. Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
    28. 2022-11-11 08:04:50+00:00 [Note] [Entrypoint]: Stopping temporary server
    29. 2022-11-11T08:04:50.284571Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.31).
    30. 2022-11-11T08:04:51.346488Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
    31. 2022-11-11 08:04:52+00:00 [Note] [Entrypoint]: Temporary server stopped
    32. 2022-11-11 08:04:52+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
    33. 2022-11-11T08:04:52.504332Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    34. 2022-11-11T08:04:52.505313Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 1
    35. 2022-11-11T08:04:52.509649Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    36. 2022-11-11T08:04:52.625646Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
    37. 2022-11-11T08:04:52.755430Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
    38. 2022-11-11T08:04:52.755480Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
    39. 2022-11-11T08:04:52.756754Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
    40. 2022-11-11T08:04:52.770087Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
    41. 2022-11-11T08:04:52.770112Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL.
  • 相关阅读:
    ffplay.c源码阅读之拉流模块实现原理
    海有舟可渡、山有路可循‍‍ —— 大学四年圆满落幕
    图论06-【无权无向】-图的遍历并查集Union Find-力扣695为例
    C高级day1
    [BUG历险记] ERROR: [SIM 211-100] CSim failed with errors
    如何使用飞书快捷指令无感记账,ios版
    jacoco—增量代码覆盖率实现
    DQL、DML、DDL、DCL的概念与区别
    Halo 开源项目学习(六):事件监听机制
    7.新增类型Symbol
  • 原文地址:https://blog.csdn.net/Dream_Weave/article/details/134418075