ysql啓動時報錯:Starting MySQL... ERROR! The server quit without updating PID file (/opt/mysql/data/mysql.pid) 的解決方法:php
一、多是/opt/mysql/data/數據目錄mysql用戶沒有權限(修改數據目錄的權限)mysql
解決方法 :給予權限,執行 "chown -R mysql.mysql /opt/mysql/data" 而後從新啓動mysqldlinux
二、可能進程裏已經存在mysql進程sql
解決方法:用命令「ps -ef|grep mysqld」查看是否有mysqld進程,若是有使用「kill -9 進程號」殺死,而後從新啓動mysqld!centos
三、多是第二次在機器上安裝mysql,有殘餘數據影響了服務的啓動。緩存
解決方法:去mysql的二進制日誌目錄看看,若是存在mysql-binlog.index,就趕快把它刪除掉吧服務器
四、mysql在啓動時沒有指定配置文件時會使用/etc/my.cnf配置文件,請打開這個文件查看在[mysqld]下有沒有指定數據目錄(datadir)。ide
解決方法:請在[mysqld]下設置這一行:datadir = /opt/mysql/dataui
五、skip-federated字段問題atom
解決方法:檢查一下/etc/my.cnf文件中有沒有沒被註釋掉的skip-federated字段,若是有就當即註釋掉吧。
六、錯誤日誌目錄不存在
解決方法:使用「chown」 「chmod」命令賦予mysql全部者及權限
七、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
|
確定是配置文件里加入了這個錯誤參數,去掉便可
本文出自 「見」 博客,請務必保留此出處http://732233048.blog.51cto.com/9323668/1636409