mysql启动报错:Starting MySQL... ERROR! The server quit without updating PID file

mysql启动时报错:Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/data/mysql.pid) 的解决方法:

首先看一下我的mysql的配置文件的配置:

cat /usr/local/mysql/my.cnf

[mysqld]

basedir = /usr/local/mysql

datadir = /opt/mysql/data

port = 3306

server_id = 1

pid-file = /opt/mysql/data/mysql.pid

socket = /tmp/mysqld.sock

default_storage_engine = InnoDB

log-bin = /opt/mysql/binlog/mysql-binlog

expire_logs_days = 14

max_binlog_size = 5G

binlog_cache_size = 10M

max_binlog_cache_size = 20M

slow_query_log

long_query_time = 2

slow_query_log_file = /opt/mysql/data/slow.log

open_files_limit = 65535

innodb = FORCE

innodb_buffer_pool_size = 100M

innodb_log_file_size = 1G

query_cache_size = 0

thread_cache_size = 64

table_definition_cache = 512

table_open_cache = 512

max_connections = 20

sort_buffer_size = 10M

max_allowed_packet = 6M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[client]

#socket=/var/lib/mysql/mysql.sock

1、可能是/opt/mysql/data/mysql.pid文件没有写的权限

解决方法 :给予权限,执行  "chown -R mysql.mysql /opt/mysql/data"   "chmod -R 755 /opt/mysql/data"  然后重新启动mysqld

2、可能进程里已经存在mysql进程

解决方法:用命令“ps -ef|grep mysqld”查看是否有mysqld进程,如果有使用“kill -9  进程号”杀死,然后重新启动mysqld!

3、可能是第二次在机器上安装mysql,有残余数据影响了服务的启动。

解决方法:去mysql的二进制日志目录看看,如果存在mysql-binlog.index,就赶快把它删除掉吧

4、mysql在启动时没有指定配置文件时会使用/etc/my.cnf配置文件,请打开这个文件查看在[mysqld]下有没有指定数据目录(datadir)。

解决方法:请在[mysqld]下设置这一行:datadir = /opt/mysql/data

5、skip-federated字段问题

解决方法:检查一下/etc/my.cnf文件中有没有没被注释掉的skip-federated字段,如果有就立即注释掉吧。

6、错误日志目录不存在

解决方法:使用“chown” “chmod”命令赋予mysql所有者及权限

7、selinux惹的祸,如果是centos系统,默认会开启selinux

解决方法:先临时改为警告模式:[[email protected] php]# setenforce 0

然后打开/etc/sysconfig/selinux,把SELINUX=enforcing改为SELINUX=disabled

附加:

经验之谈:

还有一个原因可能是:

查看配置文件/usr/local/mysql/my.cnf里有没有innodb_buffer_pool_size这个参数

innodb_buffer_pool_size:主要作用是缓存innodb表的索引,数据,插入数据时的缓冲;

默认值:128M;

专用mysql服务器设置此值的大小: 系统内存的70%-80%最佳。

如果你的系统内存不大,查看这个参数,把它的值设置小一点吧

启动成功后:

[[email protected] log]# ps -ef | grep mysql

root     11842     1  0 07:54 pts/1    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/opt/mysql/data --pid-file=/opt/mysql/data/mysql.pid

mysql    12336 11842  0 07:54 pts/1    00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/opt/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/var/log/mysqld.log --open-files-limit=65535 --pid-file=/opt/mysql/data/mysql.pid --socket=/tmp/mysqld.sock --port=3306

时间: 2024-10-05 09:55:15

mysql启动报错:Starting MySQL... ERROR! The server quit without updating PID file的相关文章

mysql修改后启动my.cnf报错Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).

mysql中文乱码解决 mysql修改my.cnf后启动报错Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid). 这里简单明了地说下: 对于mysql5.5版本,需要在/etc/mysql/my.cnf做如下修改: [client]下添加: default-character-set = utf8 [mysqld]下添加: cha

mysql启动时报错:Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/data/mysql.pid)

mysql启动报错Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/data/mysql.pid) 查看mysql错误日志也没有写入. 最后发现是selinux打开,汗…… 参考 mysql启动时报错:Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/data/mysql.pid)

启动mysql报错 -- ERROR! The server quit without updating PID file

开发说某个测试环境的mysql,无法重启了,报以下错误提示: # service mysqld restart Shutting down MySQL.. SUCCESS! Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/data/test.pid). # ps -ef|grep mysql|grep -v grep avahi 697 1 0 Sep16 ? 00:00:02

centos6.6下编译安装mysql5.6之后启动失败:Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).

今天在编译安装mysql5.6时候出现Starting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid).,当时就心碎了,之前安装时候好好的,在网上搜索帮助方法,可是没有和我一样的,有的说我没有给mysqld赋权限,可是我赋予他权限了,试了一堆方法,最后心灰意冷,准备删除mysql重新安装,就在我执行:yum remove mysql mysql

Starting MySQL... ERROR! The server quit without updating PID file 问题解决

今天遇到一个mysql起不来,不知为啥挂了,启动是下面的报错Starting MySQL... ERROR! The server quit without updating PID file 后来进到/usr/local/mysql/var目录打开err后缀的文件,其中有几句报错 /usr/local/mysql/bin/mysqld: File './mysql-bin.065896' not found (Errcode: 2) 190215 18:58:04 [ERROR] Failed

Starting MySQL. ERROR! The server quit without updating PID file

我在my.cnf中添加了一个log-bin=/data/docker/lisa/mysql/data/mysql-bin 重启mysql报错. [[email protected] data]# service mysql restart Shutting down MySQL.. SUCCESS! Starting MySQL. ERROR! The server quit without updating PID file (/data/docker/lisa/mysql/data//6e0

Starting MySQL.. ERROR! The server quit without updating PID file (/usr/local/mysql/data/vm10-0-0-19

输入:service mysqld start 报错: Starting MySQL.. ERROR! The server quit without updating PID file (/usr/local/mysql/data/vm10-0-0-19.ksc.com.pid). 解决: ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ 参考

lnmp1.1 转移mysql数据库的问题 MySQL: Starting MySQL….. ERROR! The server quit without updating PID file

1.安装前修改/etc/my.cnf,加入datadir         = /data/mysql/   再执行sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf 之后的命令,将里面的给目录加权限修改为你新的目录2.安装后停止mysql,移动/usr/local/mysql/var/ 到新目录,修改/etc/my.cnf ,查找[mysqld]  ,在下面加入datadir         = /data/mysql/  ,给

[转]MySQL: Starting MySQL….. ERROR! The server quit without updating PID file

转自: http://icesquare.com/wordpress/mysql-starting-mysql-error-the-server-quit-without-updating-pid-file/ 他也是更新系统后出现的这个问题,我是更新之后出现的该问题,所以按照他的思路删掉配置文件就可以启动了,至于为什么会出现这种问题,回头有时间再仔细研究下. This step-by-step guide is mainly for FreeBSD, however the idea is th