報錯信息:
Job for mysqld.service failed because the control process exited with error code. See “systemctl status mysqld.service” and “journalctl -xe” for details.
![](/d/20211017/02fd0be284a51339e2b2e17914b26a37.gif)
定位錯誤:
vim /var/log/mysqld.log #查看日志信息
看到最后一行(shift+G)
![](/d/20211017/78952f33f31f3cd42329a7e0886c1574.gif)
原因分析:
MySQL 數(shù)據(jù)存放位置改為 數(shù)據(jù)盤地址,重啟機(jī)器,然后磁盤掛載沒有設(shè)置為開機(jī)自動掛載,導(dǎo)致PID 文件找不到。
解決方法: 1.在/etc/my.cnf 中查看pid-file的位置
![](http://img.jbzj.com/file_images/article/202106/202163110929513.png?202153112236)
2. 創(chuàng)建對應(yīng)的目錄并修改權(quán)限
mkdir -p /var/run/mysqld
chown mysql.mysql /var/run/mysqld
這時可以嘗試重啟MySQL了,可以啟動就ok,如果還不行繼續(xù)第三步。
3. 創(chuàng)建一個pid文件并修改權(quán)限
touch /var/run/mysql/mysqld.pid
chown mysql.mysql /var/run/mysql/mysqld.pid
再啟動MySQL應(yīng)該就沒問題了!
這只是一個臨時解決的辦法,如果虛擬機(jī)重新開機(jī)就需要再次操作,暫時還沒有找到解決根本問題的方案,大家就暫時掛起虛擬機(jī),后續(xù)找到解決方法會在文章中更新!
到此這篇關(guān)于Mysql systemctl start mysqld報錯的問題解決的文章就介紹到這了,更多相關(guān)Mysql systemctl start mysqld報錯的問題解決內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
您可能感興趣的文章:- Linux連接mysql報錯:Access denied for user ‘root’@‘localhost’(using password: YES)的解決方法
- mysql登錄報錯提示:ERROR 1045 (28000)的解決方法
- mysql報錯:Deadlock found when trying to get lock; try restarting transaction的解決方法
- MySQL 啟動報錯:File ./mysql-bin.index not found (Errcode: 13)
- mysql 報錯This function has none of DETERMINISTIC解決方案
- MySql報錯Table mysql.plugin doesn’t exist的解決方法
- mysql報錯:MySQL server version for the right syntax to use near type=InnoDB的解決方法
- MySQL關(guān)于ERROR 1290 (HY000)報錯解決方法
- MySQL無法重啟報錯Warning: World-writable config file ‘/etc/my.cnf’ is ignored的解決方法