这篇文章主要为大家展示了“Macosx下使用docker/mysql会出现什么问题",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Macosx下使用docker/mysql会出现什么问题"这篇文章吧。
问题描述
在音频下如果指定本地目录替换/var/lib/mysql,运行时会出现文件权限的错误,导致服务器无法正常运行
Creatingmysql_test-mysql_1
正在附加MySQL _ test-MySQL _ 1
测试-MySQL _ 1 |初始化数据库
测试-MySQL _ 1 | 2016-03-23t 043:32:37 . 437789 z0[警告]Settinglower _ case _ table _ name=2因为filestystemfor/var/lib/MySQL/is base不敏感
test-MySQL _ 1 | 2016-03-23t 043:32:37.466955 z0[ERROR]innodb :操作系统emerornumber 13 nafileconomy .
test-MySQL _ 1 | 2016-03-23t 043:32:37。467828 z0[ERROR]innodb : the ERROrmansmysqldonnotavethe accessrightstodirectory .
test-MySQL _ 1 | 2016-03-23t 043:32:37.468824 z0[ERROR]innodb :操作系统systemererornumber 13 nafileconomy .
test-MySQL _ 1 | 2016-03-23t 043:32:37。468912 z0[ERROR]innodb : the ERROrmansmysqldoenavetheaccessrightstodirectory .
test-MySQL _ 1 | 2016-03-23t 043:32:37.470280 z0[ERROR]innodb : cannotpendatafile ' ./ibdata1 '
test-MySQL _ 1 | 2016-03-23t 043:32:37 . 470309 z0[ERROR]innodb :不能penor createsystemtablespace .如果youttriedtoaddnewdatafilestos,systemtablespace和而且失败了,则您应该拥有owedditinnodb _ data _ file _ path inmy。cnfbacktowhatitwas,以及移动new data fileinnodcreatedinthisfailedattempt .毫无疑问写满了零,但是没有使用铌
sp;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 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会出现什么问题”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注行业资讯频道!
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/117049.html