mysql启动报错:Starting MySQL… ERROR! The server quit without updating PID file
admin | 技术教程, 操作系统, 服务器相关, 网络技术 | 五月 27th, 2018 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) 的解决方法:
1、可能是/opt/mysql/data/数据目录mysql用户没有权限(修改数据目录的权限)
解决方法 :给予权限,执行 “chown -R mysql.mysql /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
解决方法:先临时改为警告模式:[root@www 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%最佳。
如果你的系统内存不大,查看这个参数,把它的值设置小一点吧
总结:
在配置文件/etc/my.cnf添加错误日志参数,一切问题都解决
[mysqld_safe]
log-error = /data/mysql/logs/error.log
启动报错时查看日志信息:
#tail -f /data/mysql/logs/error.log
1 160721 06:12:07 mysqld_safe Starting mysqld daemon with databases from /data/mysql/data
2 2018-05-21 06:12:10 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
3 2018-05-21 06:12:10 0 [Note] /opt/mysql/bin/mysqld (mysqld 5.6.27-log) starting as process 2290 ...
4 2018-05-21 06:12:10 2290 [Note] Plugin 'FEDERATED' is disabled.
5 2018-05-21 06:12:10 2290 [Warning] The option innodb (skip-innodb) is deprecated and will be removed in a future release
6 2018-05-21 06:12:10 2290 [Note] InnoDB: Using atomics to ref count buffer pool pages
7 2018-05-21 06:12:10 2290 [Note] InnoDB: The InnoDB memory heap is disabled
8 2018-05-21 06:12:10 2290 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
9 2018-05-21 06:12:10 2290 [Note] InnoDB: Memory barrier is not used
10 2018-05-21 06:12:10 2290 [Note] InnoDB: Compressed tables use zlib 1.2.3
11 2018-05-21 06:12:10 2290 [Note] InnoDB: Using CPU crc32 instructions
12 2018-05-21 06:12:10 2290 [Note] InnoDB: Initializing buffer pool, size = 128.0M
13 2018-05-21 06:12:10 2290 [Note] InnoDB: Completed initialization of buffer pool
14 2018-05-21 06:12:10 2290 [Note] InnoDB: Highest supported file format is Barracuda.
15 2018-05-21 06:12:11 2290 [Note] InnoDB: 128 rollback segment(s) are active.
16 2018-05-21 06:12:11 2290 [Note] InnoDB: Waiting for purge to start
17 2018-05-21 06:12:11 2290 [Note] InnoDB: 5.6.27 started; log sequence number 1625997
18 2018-05-21 06:12:11 2290 [ERROR] /opt/mysql/bin/mysqld: unknown option '--slave_parallel_workers=3'
19 2018-05-21 06:12:11 2290 [ERROR] Aborting
20 2018-05-21 06:12:11 2290 [Note] Binlog end
21 2018-05-21 06:12:11 2290 [Note] Shutting down plugin 'partition'
22 2018-05-21 06:12:11 2290 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
23 2018-05-21 06:12:11 2290 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
24 2018-05-21 06:12:11 2290 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
25 2018-05-21 06:12:11 2290 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
26 2018-05-21 06:12:11 2290 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
发现日志输出
1 2018-07-21 06:12:11 2290 [ERROR] /opt/mysql/bin/mysqld: unknown option '--slave_parallel_workers=3'
2 2018-07-21 06:12:11 2290 [ERROR] Aborting
肯定是配置文件里加入了这个错误参数,去掉即可
新加报错:
Starting MySQL.171019 10:11:54 mysqld_safe error: log-error set to ‘/data/tools/mysql/logs/error.log’, however file don’t exists. Create writable for user ‘mysql’.
这是在mysql新版本:5.6.35,5.6.36的一个bug
参考:https://bugs.mysql.com/bug.php?id=84427
解决:
手动创建日志文件:
touch /data/tools/mysql/logs/error.log
chown mysql. /data/tools/mysql/logs/error.log
/etc/init.d/mysqld start