Mysql启动错误 - 管理猿 2019 年 08 月 07 日 |访问: 178 次

遇到权限相关的连环错误。
服务环境:centos6.10
数据库:mysql 5.1.73
一.ls和cat等常见命令无法使用
环境变量PATH的错误,查找/etc/profile里面的PATH错误。
二.数据库启动提示查找不到文件目录。错误内容如下

Initializing MySQL database:  
FATAL ERROR: Could not find mysqld

The following directories were searched:

    /usr/local/mysql/libexec
    /usr/local/mysql/sbin
    /usr/local/mysql/bin

If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

                                                           [FAILED]

处理方案

cat /etc/my.cnf

查看datadir=/var/lib/mysql这一行有没有错误,上面提示就是这个地址不存在,导致无法启动。使用'find / -name mysql'查找数据库的真实存储目录。
三.插件错误提示

190807 12:32:50 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
190807 12:32:50 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
190807 12:32:50  InnoDB: Initializing buffer pool, size = 8.0M
190807 12:32:50  InnoDB: Completed initialization of buffer pool
190807 12:32:50  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.
190807 12:32:50 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

处理方案,对指定插件给予相应权限。

chmod -R 755 /var/lib/mysql
chown -R mysql /var/run/mysqld
chgrp -R mysql /var/run/mysqld
service mysqld restart

标签:none

添加新评论