Java自学者论坛

 找回密码
 立即注册

手机号码,快捷登录

恭喜Java自学者论坛(https://www.javazxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,会员资料板块,购买链接:点击进入购买VIP会员

JAVA高级面试进阶训练营视频教程

Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程Go语言视频零基础入门到精通Java架构师3期(课件+源码)
Java开发全终端实战租房项目视频教程SpringBoot2.X入门到高级使用教程大数据培训第六期全套视频教程深度学习(CNN RNN GAN)算法原理Java亿级流量电商系统视频教程
互联网架构师视频教程年薪50万Spark2.0从入门到精通年薪50万!人工智能学习路线教程年薪50万大数据入门到精通学习路线年薪50万机器学习入门到精通教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程MySQL入门到精通教程
查看: 577|回复: 0

InnoDB: Creating or opening ./ibdata1 failed! 异常

[复制链接]
  • TA的每日心情
    奋斗
    2024-11-24 15:47
  • 签到天数: 804 天

    [LV.10]以坛为家III

    2053

    主题

    2111

    帖子

    72万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    726782
    发表于 2021-6-3 16:39:10 | 显示全部楼层 |阅读模式

    我尝试使用Docker Machine创建本地开发设置。我在尝试创建一个mysql容器时一直遇到错误。这是我的设置。

    docker-machine version 0.3.0

    Virtualbox版本4.3.30

    虚拟机中的默认boot2docker vm,共享文件夹/用户

    我创建了要在/Users/tinnguyen/Development/Docker/containers/mysql

    创建容器时挂载的mysql文件夹

    标准许可:

    drwxr-xr-x 2 tinnguyen staff 68 Jul 25 16:45 mysql

    下面是我的docker命令

    docker run --name mysql5.6 --privileged=true -p 3306:3306  -v /Users/jice_mac/opt/docker/mysql/mysql5.6/datadir:/var/lib/mysql -v /Users/jice_mac/opt/docker/mysql/mysql5.6/conf.d:/etc/mysql/conf.d -v /Users/jice_mac/opt/docker/mysql/mysql5.6/logs:/logs -e MYSQL_ROOT_PASSWORD=123456 -e TZ=Asia/Shanghai -d mysql:5.6

    当我docker logs mysql时,这就是我得到的错误

    jice-mac:~ jice$ docker logs 1855fc0379d8
    2019-11-07 00:21:53+08:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.6.46-1debian9 started.
    2019-11-07 00:21:53+08:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
    2019-11-07 00:21:53+08:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.6.46-1debian9 started.
    2019-11-07 00:21:53+08:00 [Note] [Entrypoint]: Initializing database files
    2019-11-07 00:21:53 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2019-11-07 00:21:53 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
    2019-11-07 00:21:53 0 [Note] /usr/sbin/mysqld (mysqld 5.6.46) starting as process 48 ...
    2019-11-07 00:21:53 48 [Warning] Can't create test file /var/lib/mysql/1855fc0379d8.lower-test
    2019-11-07 00:21:53 48 [Warning] Can't create test file /var/lib/mysql/1855fc0379d8.lower-test
    2019-11-07 00:21:53 48 [Note] InnoDB: Using atomics to ref count buffer pool pages
    2019-11-07 00:21:53 48 [Note] InnoDB: The InnoDB memory heap is disabled
    2019-11-07 00:21:53 48 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    2019-11-07 00:21:53 48 [Note] InnoDB: Memory barrier is not used
    2019-11-07 00:21:53 48 [Note] InnoDB: Compressed tables use zlib 1.2.11
    2019-11-07 00:21:53 48 [Note] InnoDB: Using Linux native AIO
    2019-11-07 00:21:53 48 [Note] InnoDB: Using CPU crc32 instructions
    2019-11-07 00:21:53 48 [Note] InnoDB: Initializing buffer pool, size = 128.0M
    2019-11-07 00:21:53 48 [Note] InnoDB: Completed initialization of buffer pool
    2019-11-07 00:21:53 7f7ec84a2040  InnoDB: Operating system error number 13 in a file operation.
    InnoDB: The error means mysqld does not have the access rights to
    InnoDB: the directory.
    2019-11-07 00:21:53 7f7ec84a2040  InnoDB: Operating system error number 13 in a file operation.
    InnoDB: The error means mysqld does not have the access rights to
    InnoDB: the directory.
    2019-11-07 00:21:53 48 [ERROR] InnoDB: Creating or opening ./ibdata1 failed!
    2019-11-07 00:21:53 48 [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!
    2019-11-07 00:21:53 48 [ERROR] Plugin 'InnoDB' init function returned error.
    2019-11-07 00:21:53 48 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    2019-11-07 00:21:53 48 [ERROR] Unknown/unsupported storage engine: InnoDB
    2019-11-07 00:21:53 48 [ERROR] Aborting

    网上普遍答案是"默认情况下,它应该正确设置并运行,但您可能需要检查VirtualBox上的文件夹共享设置。

    运行VirtualBox,检查默认机器设置。单击“共享文件夹”并验证主机macbook中的/Users文件夹是否已安装在VM中。",其实就是共享目录权限问题,可以尝试把共享目录改为自己新创建的文件夹就可以了,因为默认的/User文件夹对当前用户没有相应权限(例如我将/Users 替换为/Users/jice_mac/opt就可以了)

    http://dockone.io/article/481

    https://www.thinbug.com/q/31631541

    哎...今天够累的,签到来了1...
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|小黑屋|Java自学者论坛 ( 声明:本站文章及资料整理自互联网,用于Java自学者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2025-1-23 11:15 , Processed in 0.061134 second(s), 27 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表