Linux系統(tǒng)下啟動Mysql報(bào)錯“Starting MySQL.. ERROR! The server quit without updating PID file”的綜合分析
[重要通告]如您遇疑難雜癥,本站支持知識付費(fèi)業(yè)務(wù),掃右邊二維碼加博主微信,可節(jié)省您寶貴時間哦!
這幾天安裝一個OA軟件,用到linux系統(tǒng),但是在mysql的時候就出錯,也不曉得哪里問題,有問題就需要排除了,實(shí)屬也沒啥好辦法;
(/usr/emp/data/mysqldata/centos-linux-7.pid)
[root@centos74 ~]# service mysqld start
Starting MySQL.. ERROR! The server quit without updating PID file (/usr/emp/data/mysqldata/centos-linux-7.pid).
1、 可能已經(jīng)存在?mysqld 進(jìn)程.
[root@centos74 ~]# ps -ef | grep mysqld
[root@centos74 ~]# pkill -9 mysqld
# 查看是否有這個進(jìn)程,如果有殺死掉
2、數(shù)據(jù)目錄mysql用戶是否有權(quán)限.
[root@centos74 ~]# chown -R mysql.mysql /usr/local/mysql/data
3、機(jī)器上面還有上次安裝mysql的殘留.
[root@centos74 ~]# find / -name mysql-binlog*
# 查看mysql的二進(jìn)制目錄,看是否存在mysqlbinlog.index,有的話刪掉
4、mysql 在啟動的時候會去尋找默認(rèn)的 配置文件 /etc/my.cnf? 這個目錄下的 datadir 要指定數(shù)據(jù)目錄.
# 如果沒有,那么在 my.cnf 里面添加 datadir=/usr/local/mysql/data
5、skip-federated字段問題.
# 檢查一下/etc/my.cnf文件中有沒有沒被注釋掉的skip-federated字段,如果有就立即注釋掉.
6、錯誤日志目錄不存在.
# 賦予 mysql 所有者權(quán)限 chmod chown .
7、防火墻原因.
# centos 會默認(rèn)開啟selinux .
[root@centos74 ~]# vim /etc/selinux/config
SELINUX=disabled
8、查看配置文件/usr/local/mysql/my.cnf里有沒有innodb_buffer_pool_size
# innodb_buffer_pool_size:主要作用是緩存innodb表的索引,數(shù)據(jù),插入數(shù)據(jù)時的緩沖.
# 默認(rèn)值:128M;
# 專用mysql服務(wù)器設(shè)置此值的大小: 系統(tǒng)內(nèi)存的70%-80%最佳.
# 如果你的系統(tǒng)內(nèi)存不大,查看這個參數(shù),把它的值設(shè)置小一點(diǎn).
9、關(guān)注 mysql 的報(bào)錯日志.
[root@centos74 /]# cd /usr/local/mysql/
[root@centos74 mysql]# cat mysql.err
190718 8:31:56 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
190718 8:31:56 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
190718 8:31:56 InnoDB: The InnoDB memory heap is disabled
190718 8:31:56 InnoDB: Mutexes and rw_locks use GCC atomic builtins
190718 8:31:56 InnoDB: Compressed tables use zlib 1.2.11
190718 8:31:56 InnoDB: Using Linux native AIO
190718 8:31:56 InnoDB: Initializing buffer pool, size = 128.0M
190718 8:31:56 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
190718 8:31:56 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
190718 8:31:56 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
190718 8:31:56 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
190718 8:31:56 InnoDB: Waiting for the background threads to start
190718 8:31:57 InnoDB: 5.5.62 started; log sequence number 0
190718 8:31:57 [ERROR] mysqld: unknown option '--initialize'
190718 8:31:57 [ERROR] Aborting
190718 8:31:57 InnoDB: Starting shutdown...
190718 8:31:58 InnoDB: Shutdown completed; log sequence number 1595675
190718 8:31:58 [Note] mysqld: Shutdown complete
190718 8:32:07 [Note] Plugin 'FEDERATED' is disabled.
/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
190718 8:32:07 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
190718 8:32:07 InnoDB: The InnoDB memory heap is disabled
190718 8:32:07 InnoDB: Mutexes and rw_locks use GCC atomic builtins
190718 8:32:07 InnoDB: Compressed tables use zlib 1.2.11
190718 8:32:07 InnoDB: Using Linux native AIO
190718 8:32:07 InnoDB: Initializing buffer pool, size = 128.0M
190718 8:32:07 InnoDB: Completed initialization of buffer pool
190718 8:32:07 InnoDB: highest supported file format is Barracuda.
190718 8:32:07 InnoDB: Waiting for the background threads to start
190718 8:32:08 InnoDB: 5.5.62 started; log sequence number 1595675
190718 8:32:08 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
190718 8:32:08 [Note] - '0.0.0.0' resolves to '0.0.0.0';
190718 8:32:08 [Note] Server socket created on IP: '0.0.0.0'.
190718 8:32:08 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
190718 8:33:17 [Note] Plugin 'FEDERATED' is disabled.
/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
190718 8:33:17 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
190718 8:33:17 InnoDB: The InnoDB memory heap is disabled
190718 8:33:17 InnoDB: Mutexes and rw_locks use GCC atomic builtins
190718 8:33:17 InnoDB: Compressed tables use zlib 1.2.11
190718 8:33:17 InnoDB: Using Linux native AIO
190718 8:33:17 InnoDB: Initializing buffer pool, size = 128.0M
190718 8:33:17 InnoDB: Completed initialization of buffer pool
190718 8:33:17 InnoDB: highest supported file format is Barracuda.
190718 8:33:17 InnoDB: Waiting for the background threads to start
190718 8:33:18 InnoDB: 5.5.62 started; log sequence number 1595675
190718 8:33:18 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
190718 8:33:18 [Note] - '0.0.0.0' resolves to '0.0.0.0';
190718 8:33:18 [Note] Server socket created on IP: '0.0.0.0'.
190718 8:33:18 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
190718 8:36:58 [Note] Plugin 'FEDERATED' is disabled.
/usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist
190718 8:36:58 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
190718 8:36:58 InnoDB: The InnoDB memory heap is disabled
190718 8:36:58 InnoDB: Mutexes and rw_locks use GCC atomic builtins
190718 8:36:58 InnoDB: Compressed tables use zlib 1.2.11
190718 8:36:58 InnoDB: Using Linux native AIO
190718 8:36:58 InnoDB: Initializing buffer pool, size = 128.0M
190718 8:36:58 InnoDB: Completed initialization of buffer pool
190718 8:36:58 InnoDB: highest supported file format is Barracuda.
190718 8:36:58 InnoDB: Waiting for the background threads to start
190718 8:36:59 InnoDB: 5.5.62 started; log sequence number 1595675
190718 8:36:59 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
190718 8:36:59 [Note] - '0.0.0.0' resolves to '0.0.0.0';
190718 8:36:59 [Note] Server socket created on IP: '0.0.0.0'.
190718 8:36:59 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
Linux下徹底卸載mysql詳解
一、使用以下命令查看當(dāng)前安裝mysql情況,查找以前是否裝有mysql
rpm -qa|grep -i mysql
二、停止mysql服務(wù)、刪除之前安裝的mysql
刪除命令:rpm -e --nodeps 包名
三、查找之前老版本mysql的目錄、并且刪除老版本mysql的文件和庫
find / -name mysql
刪除對應(yīng)的mysql目錄
注意:卸載后/etc/my.cnf不會刪除,需要進(jìn)行手工刪除
rm -rf /etc/my.cnf
四、再次查找機(jī)器是否安裝mysql
rpm -qa|grep -i mysql
無結(jié)果,說明已經(jīng)卸載徹底,接下來直接安裝mysql即可。
初始化 MySQL:
mysqld --initialize
啟動 MySQL:
systemctl start mysqld
查看 MySQL 運(yùn)行狀態(tài):
systemctl status mysqld
注意:如果我們是第一次啟動 mysql 服務(wù),mysql 服務(wù)器首先會進(jìn)行初始化的配置。
配置服務(wù)啟動:
1、查看開機(jī)自動啟動的服務(wù)使用chkconfig
chkconfig --list
2、確認(rèn)mysql是否在啟動運(yùn)行狀態(tài)
查詢進(jìn)程
ps -ef | grep mysqld
問題未解決?付費(fèi)解決問題加Q或微信 2589053300 (即Q號又微信號)右上方掃一掃可加博主微信
所寫所說,是心之所感,思之所悟,行之所得;文當(dāng)無敷衍,落筆求簡潔。 以所舍,求所獲;有所依,方所成!