mysql启动不了,报错“[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it”

启动mysql时报错如下:

170316 10:38:43 [Warning] '--default-character-set' is deprecated and will be removed in a future release. Please use '--character-set-server' instead.
170316 10:38:43 [Warning] /usr/libexec/mysqld: Option '--set-variable' is deprecated. Use --variable-name=value instead.
170316 10:38:43 [Warning] Can't create test file /data/mysql/sanceng.lower-test
170316 10:38:43 [Warning] Can't create test file /data/mysql/sanceng.lower-test
/usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
170316 10:38:43 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
170316 10:38:43  InnoDB: Initializing buffer pool, size = 2.0G
170316 10:38:43  InnoDB: Completed initialization of buffer pool
170316 10:38:43  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.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
170316 10:38:43 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

意思是找不到plugin.frm文件引起,这样不仅导致数据库启动不了,连pid文件和mysql.sock文件也找不到,不能登录到数据库内。


问题解决是将selinux关掉就可以了。在/etc/selinux/config下永久关闭,临时关闭使用setenforce 0命令。


Centos 5.6在默认安装的时候是seLinux是启动的。如果你用yum安装mysql的话,默认的数据库路径是在/var/lib/mysql。很多时候我们不想把数据库放在默认的位置。如果我们移动了数据库的位置,你会发现在默认情况下MYSQL是无法启动的。这主要是SELINUX的限制。你新目录上的安全上下文设置就会真不正确。

不必要时关闭掉selinux。

另外注意data目录的权限。


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值