mysql修改local inflie_mysql修改数据存储路径报错处理

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

解决?: >>>

vim /etc/my.cnf

>>>

[client]

default-character-set=utf8

socket=/storage/db/mysql/mysql.sock

[mysql]

default-character-set=utf8

socket=/storage/db/mysql/mysql.sock

2019-06-27T09:08:24.769172Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables

2019-06-27T09:08:24.769304Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.

2019-06-27T09:08:24.769322Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.

2019-06-27T09:08:24.769333Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.

2019-06-27T09:08:24.769342Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.

2019-06-27T09:08:24.769364Z 0 [ERROR] InnoDB: Cannot open datafile './ibtmp1'

2019-06-27T09:08:24.769374Z 0 [ERROR] InnoDB: Unable to create the shared innodb_temporary

2019-06-27T09:08:24.769384Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Cannot open a file

2019-06-27T09:08:25.370277Z 0 [ERROR] Plugin 'InnoDB' init function returned error.

2019-06-27T09:08:25.370330Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

2019-06-27T09:08:25.370341Z 0 [ERROR] Failed to initialize builtin plugins.

2019-06-27T09:08:25.370349Z 0 [ERROR] Aborting

解决?: >>> setenforce 0 #临时关闭selinux模式

#或永久解决

vim /etc/selinux/config

>>>

SELINUX=disabled

如果安装了apparmor

vim /etc/apparmor.d/usr.sbin.mysqld

## 有这两行,规定了mysql使用的数据文件路径权限

/var/lib/mysql/ r,

/var/lib/mysql/** rwk,

改 >>>

/data/mysql/ r,

/data/mysql/** rwk,

## 重启:

sudo service apparmor restart

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值