日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網為廣大站長提供免費收錄網站服務,提交前請做好本站友鏈:【 網站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(50元/站),

點擊這里在線咨詢客服
新站提交
  • 網站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會員:747

目錄
  • 一、安裝環境 ubuntu18 + docker 
  • 二、遇到無法啟動的問題時,查看日志發現的錯誤
  • 總結

一、安裝環境 ubuntu18 + docker 

docker run -itd --name mysql-server -v /home/docker/share/mysql-server/log/:/var/log:rw -v /home/docker/share/mysql-server/data/:/var/lib/mysql:rw -v /home/docker/share/mysql-server/conf:/etc/mysql:rw -v /etc/localtime:/etc/localtime:ro --restart=always -e MYSQL_ROOT_PASSWORD=123456 mysql

二、遇到無法啟動的問題時,查看日志發現的錯誤

docker logs --tail -n mysql-server

1、You need to specify one of the following as an environment variable:

    – MYSQL_ROOT_PASSWORD
    – MYSQL_ALLOW_EMPTY_PASSWORD
    – MYSQL_RANDOM_ROOT_PASSWORD

2022-10-24 04:21:40+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.31-1.el8 started.
2022-10-24 04:21:40+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-10-24 04:21:40+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.31-1.el8 started.
2022-10-24 04:21:40+00:00 [ERROR] [Entrypoint]: Database is uninitialized and password option is not specified
? ? You need to specify one of the following as an environment variable:
? ? - MYSQL_ROOT_PASSWORD
? ? - MYSQL_ALLOW_EMPTY_PASSWORD
? ? - MYSQL_RANDOM_ROOT_PASSWORD
2022-10-24 04:21:41+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.31-1.el8 started.
2022-10-24 04:21:41+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'

解釋: 由于mysql沒有指定root的登錄密碼導致無法啟動,默認mysql配置是不允許空密碼登錄的

原因:上面執行命令的時候寫錯了環境變量, MYSQL_SERVICE_PASSWORD 應該修改成 MYSQL_ROOT_PASSWORD

2、mysqld: Can't read dir of '/etc/mysql/conf.d/' (OS errno 2 – No such file or directory)

2022-10-24 04:17:09+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.31-1.el8 started.
2022-10-24 04:17:09+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config
	command was: mysqld --verbose --help --log-bin-index=/tmp/tmp.4hy30uDmqE
	mysqld: Can't read dir of '/etc/mysql/conf.d/' (OS errno 2 - No such file or directory)
mysqld: [ERROR] Stopped processing the 'includedir' directive in file /etc/my.cnf at line 36.
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
2022-10-24 04:17:13+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.31-1.el8 started.
2022-10-24 04:17:13+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config

解釋:可能由于不同的mysql版本,/etc/mysql目錄下的結構不一樣 

原因: 由于mysql的配置目錄/etc/mysql下有兩個空目錄, 上面的執行命令僅掛載了當前目錄,導致里面的兩個目錄沒有權限掛載到宿主機內, 應該將掛載目錄指定到具體的目錄下: -v /home/docker/share/mysql-server/conf:/etc/mysql/conf.d:rw

3、mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (OS errno 13 – Permission denied)

mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (OS errno 13 - Permission denied)
2022-10-24T06:43:20.411035Z 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.
2022-10-24T06:43:20.411089Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.31) initializing of server in progress as process 40
2022-10-24T06:43:20.412290Z 0 [ERROR] [MY-010460] [Server] --initialize specified but the data directory exists and is not writable. Aborting.
2022-10-24T06:43:20.412294Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2022-10-24T06:43:20.412593Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-10-24T06:43:20.412668Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31)  MySQL Community Server - GPL.
2022-10-24 06:43:23+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.31-1.el8 started.
2022-10-24 06:43:24+00:00 [Note] [Entrypoint]: Initializing database files
mysqld: Can't create/write to file '/var/lib/mysql/is_writable' (OS errno 13 - Permission denied)

原因: 啟動時沒有足夠的權限, /var/lib/mysql目錄沒有寫權限, 可能是部署docker時指定了–user xxx某個權限不足的用戶

總結

分享到:
標簽:Docker 無法啟動 服務器 解決方法 部署
用戶無頭像

網友整理

注冊時間:

網站:5 個   小程序:0 個  文章:12 篇

  • 51998

    網站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網站吧!
最新入駐小程序

數獨大挑戰2018-06-03

數獨一種數學游戲,玩家需要根據9

答題星2018-06-03

您可以通過答題星輕松地創建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學四六

運動步數有氧達人2018-06-03

記錄運動步數,積累氧氣值。還可偷

每日養生app2018-06-03

每日養生,天天健康

體育訓練成績評定2018-06-03

通用課目體育訓練成績評定