《Mysql學(xué)習(xí)MySQL下常見的啟動(dòng)失敗與備份失敗問題的解決教程》要點(diǎn):
本文介紹了Mysql學(xué)習(xí)MySQL下常見的啟動(dòng)失敗與備份失敗問題的解決教程,希望對(duì)您有用。如果有疑問,可以聯(lián)系我們。
MYSQL教程啟動(dòng)失敗
重啟服務(wù)器后-->重啟應(yīng)用服務(wù)(Confluence)-->報(bào)錯(cuò),數(shù)據(jù)庫連接失敗(mysql設(shè)置了開機(jī)自啟動(dòng))-->查看mysql數(shù)據(jù)庫狀態(tài):
MYSQL教程
[root@fisheye ~]# ps -ef | grep mysql
root 25555 21974 0 11:28 pts/0 00:00:00 grep mysql
MYSQL教程啟動(dòng)mysql服務(wù)器
MYSQL教程
[root@fisheye data]# service mysql start
MYSQL教程
MySQL server PID file could not be found![失敗]
Starting MySQL.............. ERROR! The server quit without updating PID file (/mydata/data/fisheye..pid).[失敗]
MYSQL教程查看差錯(cuò)日志:
MYSQL教程
[root@fisheye data]# tail -100 fisheye.err
MYSQL教程
InnoDB: Last MySQL binlog file position 0 337403929, file name ./mysql-bin.000016
141013 1:13:28 InnoDB: Waiting for the background threads to start
141013 1:13:29 InnoDB: 5.5.33 started; log sequence number 1006647152
17:13:29 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
di141013 01:13:29 mysqld_safe mysqld from pid file /mydata/data/fisheye.pid ended
MYSQL教程未發(fā)現(xiàn)明顯性差錯(cuò)提示,所以手動(dòng)創(chuàng)建一個(gè)pid文件試試
MYSQL教程
[root@fisheye data]# touch /mydata/data/fisheye.pi
MYSQL教程再進(jìn)行重啟服務(wù):
MYSQL教程
[root@fisheye data]# service mysql restart
MYSQL教程
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
MYSQL教程突然想到之前看過此類報(bào)錯(cuò)的文章,記得有可能是磁盤空間不敷導(dǎo)致的mysql無法啟動(dòng).
MYSQL教程
[root@fisheye data]# df -h
MYSQL教程(文件系統(tǒng)????????????? 容量? 已用 可用 已用% 掛載點(diǎn))
MYSQL教程
/dev/sda1 9.5G 9.5G 0 100% /
/dev/sda4 5.5G 1.3G 4.0G 24% /mnt/backup
/dev/mapper/IhuilianVG-IhuilianLV00
22G 4.2G 17G 20% /var/www/app
tmpfs 1.3G 0 1.3G 0% /dev/shm
MYSQL教程果然如此,下面羅列一些類似問題(無法啟動(dòng))的解決思路:
1.可能是datadir目錄存在的分區(qū)滿了(df -h )
?????? 解決辦法:打開配置文件/etc/my.cnf,在[mysqld]節(jié)下重新指定數(shù)據(jù)目錄(datadir),并將原來的數(shù)據(jù)目錄遷移到重新制定的數(shù)據(jù)目錄處
?????? 關(guān)于遷移:(1)、cp或者tar的時(shí)候一定要把權(quán)限給帶上,但是為防止意外建議再授權(quán)一次;(2)、數(shù)據(jù)比較大時(shí)一定要先壓縮再遷移,保證完整性,特別是scp到其他機(jī)器時(shí)可能會(huì)超時(shí)所以一定要壓縮(tar.gz);(3)、若是移動(dòng)至另外的服務(wù)器一定要保證mysql版本一致.
MYSQL教程2.可能是/mydata/data/fisheye.pid文件沒有寫的權(quán)限
????? 解決辦法 :給予權(quán)限,執(zhí)行 “chown -R mysql:mysql /mydata/data/”? 然后重新啟動(dòng)mysqld!
MYSQL教程3.可能進(jìn)程里已經(jīng)存在mysql進(jìn)程
????? 解決辦法:用命令“ps -ef|grep mysqld”查看是否有mysqld進(jìn)程,如果有使用“kill -9? 進(jìn)程號(hào)”殺死,然后重新啟動(dòng)mysqld!
MYSQL教程4.可能是第二次在機(jī)器上安裝mysql,有殘余數(shù)據(jù)影響了服務(wù)的啟動(dòng).
?????? 解決辦法:去mysql的數(shù)據(jù)目錄/data看看,如果存在mysql-bin.index,就趕快把它刪除掉吧,它就是罪魁禍?zhǔn)琢?
MYSQL教程5.skip-federated字段問題(報(bào)錯(cuò)信息:[ERROR] /mydata/data/mysql/libexec/mysqld: unknown option '--skip-federated')
?????? 解決辦法:檢查一下/etc/my.cnf文件中有沒有沒被注釋掉的skip-federated字段,如果有就立即注釋掉吧.
MYSQL教程6.selinux惹的禍,如果是centos系統(tǒng),默認(rèn)會(huì)開啟selinux
?????? 解決辦法:關(guān)閉它,打開/etc/selinux/config,把SELINUX=enforcing改為SELINUX=disabled后存盤退出重啟機(jī)器試試.
MYSQL教程備份失敗
說明
執(zhí)行 mysqldump 時(shí)出現(xiàn)找不到某一個(gè) tables 而且中斷執(zhí)行?及鎖表后延伸出現(xiàn)的問題記錄!
問題及方案如下
Error Meaage: 執(zhí)行mysqldump 時(shí)出現(xiàn)找不到某一個(gè) tables 而且中斷執(zhí)行
MYSQL教程
[root@test100 data]# mysqldump fx > fx.sql
MYSQL教程
mysqldump: Got error: 1146: Table 'user_suggest_report' doesn't exist when using LOCK TABLES
MYSQL教程考慮加上 --skip-lock-tables或者-R進(jìn)行鎖表嘗嘗,也是不行,信息如下
MYSQL教程
[root@test100 data]#mysqldump --skip-lock-tables fx > fx.sql
MYSQL教程
Error: Couldn't read status information for table vote_results () mysqldump: Couldn't execute 'show create table `user_suggest_report`': Table 'fx.user_suggest_report' doesn't exist (1146)
MYSQL教程登陸服務(wù)器查看是否存在此表
MYSQL教程
[root@test100 data]#mysql -h127.0.0.1 -D fx
mysql> show tables; #查看所有的表 --> 發(fā)現(xiàn)是表存在的
MYSQL教程
+--------------------------------+
| Tables_in_fx |
+--------------------------------+
| user_suggest_report |
+--------------------------------+
80 rows in set (0.00 sec)
MYSQL教程刪除此表
MYSQL教程
mysql> drop table user_suggest_report; #既然是存在的,但是系統(tǒng)卻認(rèn)定不存在闡明存在問題,索性想刪除試試
MYSQL教程
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'user_suggest_report' at line 1
MYSQL教程進(jìn)入mysql存儲(chǔ)目錄下將其數(shù)據(jù)表移動(dòng)或刪除
MYSQL教程
[root@test100 data]# cat /etc/my.cnf | grep datadir
datadir=/var/lib/mysql
[root@test100 data]# cd /var/lib/mysql/fx/
[root@test100 fx]# mv user_suggest_report.frm /data
MYSQL教程重啟mysql服務(wù)器
MYSQL教程
[root@test100 fx]# service mysqld restart
MYSQL教程重新備份操作
MYSQL教程
[root@test100 data]# mysqldump fx > fx.150109.sql #操作勝利
歡迎參與《Mysql學(xué)習(xí)MySQL下常見的啟動(dòng)失敗與備份失敗問題的解決教程》討論,分享您的想法,維易PHP學(xué)院為您提供專業(yè)教程。
轉(zhuǎn)載請(qǐng)注明本頁網(wǎng)址:
http://www.fzlkiss.com/jiaocheng/11490.html