在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

Macosx下使用docker/mysql会出现什么问题

125次阅读
没有评论

共计 3160 个字符,预计需要花费 8 分钟才能阅读完成。

这篇文章主要为大家展示了“Macosx 下使用 docker/mysql 会出现什么问题”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让丸趣 TV 小编带领大家一起研究并学习一下“Macosx 下使用 docker/mysql 会出现什么问题”这篇文章吧。

问题描述

在 macosx 下如果指定本地目录替换 /var/lib/mysql,运行时会出现文件权限的错误,导致 mysqld 无法正常运行

Creating mysql_test-mysql_1
Attaching to mysql_test-mysql_1
test-mysql_1 | Initializing database
test-mysql_1 | 2016-03-23T04:32:37.437789Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
test-mysql_1 | 2016-03-23T04:32:37.466955Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
test-mysql_1 | 2016-03-23T04:32:37.467828Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
test-mysql_1 | 2016-03-23T04:32:37.468824Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
test-mysql_1 | 2016-03-23T04:32:37.468912Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
test-mysql_1 | 2016-03-23T04:32:37.470280Z 0 [ERROR] InnoDB: Cannot open datafile  ./ibdata1 
test-mysql_1 | 2016-03-23T04:32:37.470309Z 0 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
test-mysql_1 | 2016-03-23T04:32:37.470317Z 0 [ERROR] InnoDB: InnoDB Database creation was aborted with error Cannot open a file. You may need to delete the ibdata1 file before trying to start up again.
test-mysql_1 | 2016-03-23T04:32:38.073222Z 0 [ERROR] Plugin  InnoDB  init function returned error.
test-mysql_1 | 2016-03-23T04:32:38.073268Z 0 [ERROR] Plugin  InnoDB  registration as a STORAGE ENGINE failed.
test-mysql_1 | 2016-03-23T04:32:38.073283Z 0 [ERROR] Failed to initialize plugins.
test-mysql_1 | 2016-03-23T04:32:38.073289Z 0 [ERROR] Aborting
test-mysql_1 | 
mysql_test-mysql_1 exited with code 1

解决方案

创建在 scripts 目录下 mysqld 启动脚本

#!/bin/bash
# From https://github.com/docker-library/mysql/issues/99
set -e # fail on any error
echo  * Working around permission errors in Docker on Mac locally by making sure that  mysql  uses the same uid and gid as the host volume 
TARGET_UID=$(stat -c  %u  /var/lib/mysql)
echo  -- Setting mysql user to use uid  $TARGET_UID
usermod -o -u $TARGET_UID mysql || true
TARGET_GID=$(stat -c  %g  /var/lib/mysql)
echo  -- Setting mysql group to use gid  $TARGET_GID
groupmod -o -g $TARGET_GID mysql || true
echo  * Starting MySQL 
chown -R mysql:root /var/run/mysqld/
/entrypoint.sh mysqld --user=mysql --console

创建 docker-compose.py,指定 run-mysqld.sh 脚本为容器入口

test-mysql:
 image: mysql 
 ports:
 -  3306:3306 
 volumes: 
 - /localhost/mysql/data:/var/lib/mysql 
 - ./scripts/run-mysqld.sh:/run-mysqld.sh
 environment:
 - MYSQL_DATABASE=play
 - MYSQL_USER=play
 - MYSQL_PASSWORD=play
 - MYSQL_ROOT_PASSWORD=123456
 entrypoint: /run-mysqld.sh

运行 docker-compose up 命令,启动容器

以上是“Macosx 下使用 docker/mysql 会出现什么问题”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注丸趣 TV 行业资讯频道!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-19发表,共计3160字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 精品国产青草久久久久福利 | 免费a级毛片无码a∨ | 欧美性猛交ⅹxxx乱大交妖精 | 好屌草这里只有精品 | 久久精品8 | 成人午夜免费福利视频 | 亚洲国产精品无码久久久 | 欧妇女乱妇女乱视频 | 久久宗合色 | 五月婷婷开心中文字幕 | 亚洲三级视频在线观看 | 久久一级片| 天天做天天爱夜夜爽导航 | 久久免费视频在线观看30 | 欧美性xxxx极品少妇 | 在线观看亚洲一区二区 | 亚洲av永久无码精品三区在线 | 欧美成人午夜不卡在线视频 | 男女午夜爽爽大片免费 | 国产成人综合亚洲欧美天堂 | 亚洲一区二区三区在线播放 | 狠狠躁天天躁中文字幕无码 | 国产区精品视频 | 亚洲欧美18岁网站 | 黄色成人网站免费无码av | 少妇无码太爽了不卡视频在线看 | 国产精品久久久一区二区三区 | 手机看片久久高清国产日韩 | 大桥久未无码吹潮在线观看 | 在线不卡视频 | 午夜视频在线免费看 | 老熟女毛茸茸浓毛 | 无遮挡毛片 | 亚洲视频在线观看免费 | 久草视频电影 | 国产91青青成人a在线 | 精品哟哟哟国产在线不卡 | 国产欧美日韩亚洲 | 色一区二区 | 日本边添边摸边做边爱的视频 | 亚洲国产成人精品无码区花野真一 |