[Warning] Can‘t create test file .lower-test

[Warning] Can't create test file .lower-test

问题描述:今天mysql自己关闭了,且重启依然失败,查看错误日志,信息如下

2022-04-21T06:22:56.142556Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2022-04-21T06:22:56.142599Z 0 [Warning] Changed limits: max_connections: 214 (requested 500)
2022-04-21T06:22:56.142601Z 0 [Warning] Changed limits: table_open_cache: 400 (requested 2000)
2022-04-21T06:22:56.306769Z 0 [Warning] Can't create test file /mnt/newsqldatadir/mysql/iZ8vb6ptmkjv5sahud27xwZ.lower-test
2022-04-21T06:22:56.306829Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.33-0ubuntu0.16.04.1-log) starting as process 10703 ...
2022-04-21T06:22:56.309947Z 0 [Warning] Can't create test file /mnt/newsqldatadir/mysql/iZ8vb6ptmkjv5sahud27xwZ.lower-test
2022-04-21T06:22:56.309983Z 0 [Warning] Can't create test file /mnt/newsqldatadir/mysql/iZ8vb6ptmkjv5sahud27xwZ.lower-test
2022-04-21T06:22:56.313151Z 0 [Note] InnoDB: PUNCH HOLE support available
2022-04-21T06:22:56.313187Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-04-21T06:22:56.313193Z 0 [Note] InnoDB: Uses event mutexes
2022-04-21T06:22:56.313197Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2022-04-21T06:22:56.313202Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2022-04-21T06:22:56.313208Z 0 [Note] InnoDB: Using Linux native AIO
2022-04-21T06:22:56.313506Z 0 [Note] InnoDB: Number of pools: 1
2022-04-21T06:22:56.313664Z 0 [Note] InnoDB: Using CPU crc32 instructions
2022-04-21T06:22:56.315384Z 0 [Note] InnoDB: Initializing buffer pool, total size = 3G, instances = 8, chunk size = 128M
2022-04-21T06:22:56.509359Z 0 [Note] InnoDB: Completed initialization of buffer pool
2022-04-21T06:22:56.551516Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-04-21T06:22:56.561660Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2022-04-21T06:22:56.561685Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2022-04-21T06:22:56.561692Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2022-04-21T06:22:57.162151Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2022-04-21T06:22:57.162185Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2022-04-21T06:22:57.162194Z 0 [ERROR] Failed to initialize builtin plugins.
2022-04-21T06:22:57.162200Z 0 [ERROR] Aborting

2022-04-21T06:22:57.162207Z 0 [Note] Binlog end
2022-04-21T06:22:57.162657Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

开始查询[ERROR] InnoDB: The innodb_system data file ‘ibdata1’ must be writable,结果授权了也没用,于是查询[Warning] Can’t create test file /mnt/newsqldatadir/mysql/iZ8vb6ptmkjv5sahud27xwZ.lower-test,找到了解决办法

解决:编辑/etc/apparmor.d/usr.sbin.mysqld 文件,将ibdata1的目录贴到里面并重启apparmor

# 查找ibdata1路径
find / -name ibdata1
# 或
locate ibdata1

# 编辑usr.sbin.mysqld文件
vi /etc/apparmor.d/usr.sbin.mysqld
# 新增内容
# Allow data dir access
  /var/lib/mysql/ r,
  /var/lib/mysql/** rwk,
  # 下面是新增的内容
  /mnt/newsqldatadir/mysql/ r,
  /mnt/newsqldatadir/mysql/** rwk,

# 重启apparmor服务
sudo service apparmor restart
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值