欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

mysql启动报错:Starting MySQL... ERROR! The server quit without updating PID file wdcp 重装升级安装 mysql 启动报错 自己亲自做的 有大用 有大大用 有大大大用

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

service mysql status


ERROR! MySQL is not running, but lock file (//var/lock/subsys/mysql) exists


 

 

 

1、 service mysqld restart 看看应该是启动的哪个mysql版本 可以看看 /node-admin/9706 或 /node-admin/12630  这两个表达的意思是一样的


可能是/opt/mysql/data/数据目录mysql用户没有权限(修改数据目录的权限)(权限一定要记住)

   (正常情况下 wdcp 应该是 # id mysql 结果为用户id 27 组id为27)

   可是我发觉到组id为501(可者ls -la mysql目录)

image.png

   解决方法 :给予权限,执行  "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添加错误日志参数,一切问题都解决  

1
2
[mysqld_safe]
log-error = /data/mysql/logs/error.log

        启动报错时查看日志信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#tail -f /data/mysql/logs/error.log
 
160721 06:12:07 mysqld_safe Starting mysqld daemon with databases from /data/mysql/data
2016-07-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).
2016-07-21 06:12:10 0 [Note] /opt/mysql/bin/mysqld (mysqld 5.6.27-log) starting as process 2290 ...
2016-07-21 06:12:10 2290 [Note] Plugin 'FEDERATED' is disabled.
2016-07-21 06:12:10 2290 [Warning] The option innodb (skip-innodb) is deprecated and will be removed in a future release
2016-07-21 06:12:10 2290 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-07-21 06:12:10 2290 [Note] InnoDB: The InnoDB memory heap is disabled
2016-07-21 06:12:10 2290 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-07-21 06:12:10 2290 [Note] InnoDB: Memory barrier is not used
2016-07-21 06:12:10 2290 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-07-21 06:12:10 2290 [Note] InnoDB: Using CPU crc32 instructions
2016-07-21 06:12:10 2290 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-07-21 06:12:10 2290 [Note] InnoDB: Completed initialization of buffer pool
2016-07-21 06:12:10 2290 [Note] InnoDB: Highest supported file format is Barracuda.
2016-07-21 06:12:11 2290 [Note] InnoDB: 128 rollback segment(s) are active.
2016-07-21 06:12:11 2290 [Note] InnoDB: Waiting for purge to start
2016-07-21 06:12:11 2290 [Note] InnoDB: 5.6.27 started; log sequence number 1625997
2016-07-21 06:12:11 2290 [ERROR] /opt/mysql/bin/mysqld: unknown option '--slave_parallel_workers=3'
2016-07-21 06:12:11 2290 [ERROR] Aborting
2016-07-21 06:12:11 2290 [Note] Binlog end
2016-07-21 06:12:11 2290 [Note] Shutting down plugin 'partition'
2016-07-21 06:12:11 2290 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2016-07-21 06:12:11 2290 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2016-07-21 06:12:11 2290 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2016-07-21 06:12:11 2290 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2016-07-21 06:12:11 2290 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'

     发现日志输出

1
2
2016-07-21 06:12:11 2290 [ERROR] /opt/mysql/bin/mysqld: unknown option '--slave_parallel_workers=3'
2016-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


来自 http://732233048.blog.51cto.com/9323668/1636409

 

普通分类: