解決Centos7 4無法啟動mysql異常

2021-08-21 06:26:06 字數 3932 閱讀 3615

重啟前好好的系統;重啟後,web頁面打不開。查tomcat日誌發現償試連線資料庫3次失敗。登入伺服器,shell命令也不能正常連線。檢視系統程序沒有mysql。

啟動mysql服務報錯

[root@zhangcool-cooler01 init.d]# systemctl start mysqld

job for mysqld.service failed because the control process exited with error code. see "systemctl status mysqld.service" and "journalctl -xe" for details.

[root@zhangcool-cooler01 init.d]# service mysqld start

starting mysqld (via systemctl):  job for mysqld.service failed because the control process exited with error code. see "systemctl status mysqld.service" and "journalctl -xe" for details.

[failed]

根據提示檢查服務狀態

[root@zhangcool-cooler01 init.d]# systemctl status mysqld.service

● mysqld.service - sysv: mysql database server.

loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)

active: failed (result: exit-code) since fri 2018-07-06 13:43:52 cst; 1min 2s ago

docs: man:systemd-sysv-generator(8)

process: 3886 execstart=/etc/rc.d/init.d/mysqld start (code=exited, status=1/failure)

jul 06 13:43:51 zhangcool-cooler01 systemd[1]: starting sysv: mysql database server....

jul 06 13:43:52 zhangcool-cooler01 mysqld[3886]: mysql daemon failed to start.

jul 06 13:43:52 zhangcool-cooler01 mysqld[3886]: starting mysqld: [failed]

jul 06 13:43:52 zhangcool-cooler01 systemd[1]: mysqld.service: control process exited, code=exited status=1

jul 06 13:43:52 zhangcool-cooler01 systemd[1]: failed to start sysv: mysql database server..

jul 06 13:43:52 zhangcool-cooler01 systemd[1]: unit mysqld.service entered failed state.

jul 06 13:43:52 zhangcool-cooler01 systemd[1]: mysqld.service failed.

[root@zhangcool-cooler01 init.d]# journalctl -xe

jul 06 13:42:58 zhangcool-cooler01 polkitd[477]: unregistered authentication agent for unix-process:3597:8111728 (system bus name :1.355, object path

jul 06 13:43:51 zhangcool-cooler01 polkitd[477]: registered authentication agent for unix-process:3880:8117203 (system bus name :1.356 [/usr/bin/pktt

jul 06 13:43:51 zhangcool-cooler01 systemd[1]: starting sysv: mysql database server....

-- subject: unit mysqld.service has begun start-up

-- defined-by: systemd

-- support:

-- -- unit mysqld.service has begun starting up.

jul 06 13:43:52 zhangcool-cooler01 mysqld[3886]: mysql daemon failed to start.

jul 06 13:43:52 zhangcool-cooler01 mysqld[3886]: starting mysqld:  [failed]

jul 06 13:43:52 zhangcool-cooler01 systemd[1]: mysqld.service: control process exited, code=exited status=1

jul 06 13:43:52 zhangcool-cooler01 systemd[1]: failed to start sysv: mysql database server..

-- subject: unit mysqld.service has failed

-- defined-by: systemd

-- support:

-- -- unit mysqld.service has failed.

-- -- the result is failed.

jul 06 13:43:52 zhangcool-cooler01 systemd[1]: unit mysqld.service entered failed state.

jul 06 13:43:52 zhangcool-cooler01 systemd[1]: mysqld.service failed.

jul 06 13:43:52 zhangcool-cooler01 polkitd[477]: unregistered authentication agent for unix-process:3880:8117203 (system bus name :1.356, object path

檢視mysql日誌,分析mysql啟動過程有何異常

[root@zhangcool-cooler01 init.d]# vi /var/log/mysqld.log

2018-07-06t05:43:52.466691z 0 [note] server socket created on ip: '::'.

2018-07-06t05:43:52.469258z 0 [error] /usr/sbin/mysqld: can't create/write to file '/var/run/mysqld/mysqld.pid' (errcode: 2 - no such file or directory)

2018-07-06t05:43:52.469270z 0 [error] can't start server: can't create pid file: no such file or directory

原來/var/run/mysqld目錄不存在,所在mysqld.pid無法建立

建立目錄/var/run/mysqld,並授權,再次啟動mysql成功

drwxr-xr-x. 2 root root 40 jul 6 13:54 mysqld

drwxr-xr-x. 2 mysql mysql 40 jul 6 13:54 mysqld

EOS編譯(環境Centos7 4)

首先從github上拉eos的原始碼 git clone recursive如果沒加 recursive,則拉完原始碼後需要在原始碼目錄執行以下命令 如果沒有執行,執行編譯命令時會提示 git submodule update init recursive執行編譯命令 sh eosio build....

CentOS 7 4 編譯安裝Tengine

tengine官網上有個非常簡單的教程,中間並未涉及到一些常用的設定,所以僅供參考。一下午為本人的安裝步驟及過程。配置firewalld,iptables,關閉selinux 1 安裝必要的編譯環境好 由於tengine安裝需要使用源 自行編譯,所以在安裝前需要安裝必要的編譯工具 yum y upd...

centos7 4 基礎使用者環境

切換root sudo su 或者建立新使用者,因為在linux下通過useradd方式建立新使用者python時,都會將所有的配置檔案從 etc skel複製到 home目錄的新使用者錄下。但現在這個python目錄是新建立的,空的,那麼就要複製 etc skel這個目錄的檔案到 home ico...