記一次令人絕望的mysql啟動報錯
簡述:
今天在做LNMP環境的時候,mysql啟動失敗,LNMP環境是用的oneinstack一鍵安裝指令碼安裝的。
報錯簡述:
➜ sudo systemctl restart mysqld.service
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
➜ sudo systemctl status mysqld.service
● mysqld.service - LSB: start and stop MySQL
Loaded: loaded (/etc/init.d/mysqld; generated)
Active: failed (Result: exit-code) since Tue 2018-11-06 18:31:34 CST; 6s ago
Docs: man:systemd-sysv-generator(8)
Process: 22460 ExecStart=/etc/init.d/mysqld start (code=exited, status=1/FAILURE)
11月 06 18:31:33 ubuntu-kevin systemd[1]: Starting LSB: start and stop MySQL...
11月 06 18:31:33 ubuntu-kevin mysqld[22460]: Starting MySQL
11月 06 18:31:34 ubuntu-kevin mysqld[22460]: . * The server quit without updating PID file (/tmp/mysql.pid).
11月 06 18:31:34 ubuntu-kevin systemd[1]: mysqld.service: Control process exited, code=exited status=1
11月 06 18:31:34 ubuntu-kevin systemd[1]: mysqld.service: Failed with result 'exit-code'.
11月 06 18:31:34 ubuntu-kevin systemd[1]: Failed to start LSB: start and stop MySQL.
大致意思是因為/tmp
目錄缺少啟動檔案(mysql.pid
)導致的,恩,於是參照網上提供的方法,修改/etc/my.cnf
檔案
#socket = /tmp/mysql.sock
socket = /var/lib/mysql/mysql.sock
修改pid檔案的存放目錄,然後chmod -R 777 /var/lib/mysql/
重新啟動,恩?失敗!!
➜ sudo systemctl status mysqld.service
● mysqld.service - LSB: start and stop MySQL
Loaded: loaded (/etc/init.d/mysqld; generated)
Active: failed (Result: exit-code) since Tue 2018-11-06 18:31:34 CST; 6s ago
Docs: man:systemd-sysv-generator(8)
Process: 22460 ExecStart=/etc/init.d/mysqld start (code=exited, status=1/FAILURE)
11月 06 18:31:33 ubuntu-kevin systemd[1]: Starting LSB: start and stop MySQL...
11月 06 18:31:33 ubuntu-kevin mysqld[22460]: Starting MySQL
11月 06 18:31:34 ubuntu-kevin mysqld[22460]: . * The server quit without updating PID file (/var/lib/mysql/mysql.pid).
11月 06 18:31:34 ubuntu-kevin systemd[1]: mysqld.service: Control process exited, code=exited status=1
11月 06 18:31:34 ubuntu-kevin systemd[1]: mysqld.service: Failed with result 'exit-code'.
11月 06 18:31:34 ubuntu-kevin systemd[1]: Failed to start LSB: start and stop MySQL.
那繼續,還有大佬說檢視mysql報錯日誌
➜ vi /data/mysql/mysql-error.log
檔案無法開啟???許可權不夠?行吧,我sudo
➜ sudo vi /data/mysql/mysql-error.log
2018-11-04T11:47:38.194829Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 181104 19:47:38
2018-11-04T11:47:39.352071Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2592787
2018-11-04T11:47:39.353709Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-11-04T11:47:39.353718Z 0 [Note] Shutting down plugin 'MEMORY'
2018-11-04T11:47:39.353723Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2018-11-04T11:47:39.353726Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2018-11-04T11:47:39.353741Z 0 [Note] Shutting down plugin 'sha256_password'
2018-11-04T11:47:39.353743Z 0 [Note] Shutting down plugin 'mysql_native_password'
2018-11-04T11:47:39.353856Z 0 [Note] Shutting down plugin 'binlog'
2018-11-04T11:47:39.465526Z 0 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
等會,好像有什麼不對啊,今天明明是11-06,你這個11-04什麼鬼!!!!
絕望~
然後冷靜下來,想到,剛剛檢視日誌檔案為什麼會顯示許可權不夠,什麼時候vi都要超級管理員許可權了。
然後ll
看了一下檔案的所屬
drwxr-x--- 2 1002 1002 4096 11月 4 19:47 mysql
嗯哼,這個1002是什麼鬼,頓時發現問題
解決方法:
建立mysql使用者和mysql組
➜ sudo useradd mysql -g mysql
➜ sudo groupadd mysql
➜ chown -R mysql:mysql /usr/local/mysql
➜ chown -R mysql:mysql /var/lib/mysql
➜ chown -R mysql:mysql /data/mysql
➜ sudo systemctl restart mysqld.service
nice啟動成功了!!!
➜ mysql mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.24-log MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]>
MySQL [(none)]> quit
Bye
開心~~
相關文章
- 記一次mysql無法啟動的解決方案MySql
- ubuntu 絕望事件Ubuntu事件
- MySQL 啟動報錯 error while loading shared librariesMySqlErrorWhile
- innodb_undo_tablespaces導致Mysql啟動報錯MySql
- MySQL啟動報錯:The server quit without updating PID fileMySqlServerUI
- 有點小絕望
- MySQL一次沒有報錯的關閉MySql
- 記一次 K3s MySQL 啟動 OOM 排查MySqlOOM
- 記錄一次Git報錯Git
- myeclipse啟動報錯Eclipse
- 升級到 MySQL 8.4,MySQL 啟動報錯:io_setup() failed with EAGAINMySqlAI
- 處理mysql無法啟動且啟動時服務沒報錯的異常情況MySql
- 第一次使用jrebel啟動專案報錯解決
- 記一次android app啟動錯誤 Error running :Default Activity not foundAndroidAPPError
- mysql 啟動報錯Can't connect to local MySQL server through socket '/data/mysql/mysql/mysql.sock'(111)MySqlServer
- 啟動mysql報錯“服務沒有響應控制功能”MySql
- Homestead 啟動 elasticsearch 報錯Elasticsearch
- 本地nacos啟動報錯
- 第一次啟動react-native run-android ,報錯eventEmitterReactAndroidMIT
- 記錄一次定時器報錯定時器
- Mac 上啟動 appium 報錯MacAPP
- apache啟動報錯:httpd: aprApachehttpd
- 解決啟動openfeign報錯
- laravel sail 首次啟動報錯LaravelAI
- 記一次 打包報錯:Keystore was tampered with, or password was incorrect
- MySQL啟動報錯InnoDB: The innodb_system data file './ibdata1' is of a differentMySql
- 記一次sshd無法啟動的修復
- Mysql自動處理同步報錯MySql
- Flink啟動Yarn session模式的部署報錯YarnSession模式
- 記一次 Homestead 啟動故障修復
- Centos7啟動Nginx報錯。CentOSNginx
- Redis 啟動報錯Address already in useRedis
- nginx 啟動報錯 unknown directive "server"NginxServer
- Xcode啟動RN報錯"`fsevents` unavailable"XCodeAI
- mongodb啟動報錯怎麼辦MongoDB
- 美國國家老齡化研究所報告:教育、絕望和死亡
- 記一次 Redis 的事務引起的訊息佇列報錯Redis佇列
- 《暗黑地牢》—“克蘇魯”式的絕望冒險