在centos8系統(tǒng)上安裝MySQL,使用的是centos7上安裝MySQL的腳本,出現(xiàn)了以下問(wèn)題,以做記錄:
問(wèn)題一:日志文件不存在,MySQL無(wú)法啟動(dòng)
錯(cuò)誤日志:
[root@confluence packages]# /etc/init.d/mysqld restart ERROR! MySQL server PID file could not be found! Starting MySQL.2022-01-15T03:58:44.753030Z mysqld_safe error: log-error set to '/var/log/mariadb/mariadb_error.log', however file don't exists. Create writable for user 'mysql'. ERROR! The server quit without updating PID file (/home/confluence/mysql/mysql_data/confluence.pid). 1.2.3.4.
原因和解決方法:
根據(jù)日志提示,MySQL無(wú)法啟動(dòng)是因?yàn)橹付ǖ娜罩疚募?var/log/mariadb/mariadb_error.log不存在
touch創(chuàng)建/var/log/mariadb/mariadb_error.log,并修改權(quán)限為mysql:mysql,該錯(cuò)誤解決。
問(wèn)題二:/etc/my.cnf文件為空,MySQL無(wú)法啟動(dòng)
錯(cuò)誤日志:
[root@confluence packages]# /etc/init.d/mysqld start Starting MySQL.. ERROR! The server quit without updating PID file (/home/confluence/mysql/mysql_data/confluence.pid). [root@confluence packages]#
1.2.3.
原因和解決方法:
原因是/etc/my.cnf文件是空的,什么配置都沒(méi)有。
查看/etc/my.cnf,文件沒(méi)有配置數(shù)據(jù)目錄等信息,文件內(nèi)容如下:
[root@confluence mysql]# cat /etc/my.cnf # # This group is read both both by the client and the server # use it for options that affect everything # [client-server] # # include all files from the config directory # !includedir /etc/my.cnf.d[root@confluence mysql]# 1.2.3.4.5.6.7.8.9.10.11.12.13. /etc/my.cnf.d目錄下只存在client.cnf一個(gè)文件,內(nèi)容也是空的: [root@confluence mysql]# cat /etc/my.cnf.d/client.cnf # # These two groups are read by the client library # Use it for options that affect all clients, but not the server # [client] # This group is not read by mysql client library, # If you use the same .cnf file for MySQL and MariaDB, # use it for MariaDB-only client options [client-mariadb][root@confluence mysql]# 1.2.3.4.5.6.7.8.9.10.11.12.
把/etc/my.cnf文件補(bǔ)充完整,問(wèn)題即解決。
問(wèn)題三:/etc/my.cnf文件權(quán)限過(guò)大導(dǎo)致MySQL無(wú)法啟動(dòng)
錯(cuò)誤日志:
[root@confluence etc]# /etc/init.d/mysqld start my_print_defaults: [Warning] World-writable config file '/etc/my.cnf' is ignored. Starting MySQL.my_print_defaults: [Warning] World-writable config file '/etc/my.cnf' is ignored. my_print_defaults: [Warning] World-writable config file '/etc/my.cnf' is ignored. .. ERROR! The server quit without updating PID file (/home/confluence/mysql/mysql_data/confluence.pid). [root@confluence etc]#
原因和解決方法:
原因是因?yàn)?etc/my.cnf文件是從其它節(jié)點(diǎn)拷貝拷貝過(guò)來(lái)的,上傳后默認(rèn)的權(quán)限過(guò)大。把/etc/my.cnf文件的權(quán)限改成644,重新啟動(dòng)MySQL則成功。
原文來(lái)自:https://blog.51cto.com/u_10950710/4977853
本文地址:https://www.linuxprobe.com/centos-mysql-yy.html編輯:王華超,審核員:逄增寶
Linux命令大全:https://www.linuxcool.com/
Linux系統(tǒng)大全:https://www.linuxdown.com/
紅帽認(rèn)證RHCE考試心得:https://www.rhce.NET/