啟動失敗
重啟服務器后-->重啟應用服務(Confluence)-->報錯,數(shù)據(jù)庫連接失敗(mysql設置了開機自啟動)-->查看mysql數(shù)據(jù)庫狀態(tài):
1
2
|
[root@fisheye ~] # ps -ef | grep mysql root 25555 21974 0 11:28 pts /0 00:00:00 grep mysql |
啟動mysql服務器
1
|
[root@fisheye data] # service mysql start |
1
2
|
MySQL server PID file could not be found![失敗] Starting MySQL.............. ERROR! The server quit without updating PID file (/mydata/data/fisheye..pid).[失敗] |
查看錯誤日志:
1
|
[root@fisheye data] # tail -100 fisheye.err |
1
2
3
4
5
6
7
8
9
|
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 |
未發(fā)現(xiàn)明顯性錯誤提示,所以手動創(chuàng)建一個pid文件試試
1
|
[root@fisheye data] # touch /mydata/data/fisheye.pi |
再進行重啟服務:
1
|
[root@fisheye data] # service mysql restart |
1
|
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) |
突然想到之前看過此類報錯的文章,記得有可能是磁盤空間不足導致的mysql無法啟動。
1
|
[root@fisheye data] # df -h |
(文件系統(tǒng) 容量 已用 可用 已用% 掛載點)
1
2
3
4
5
|
/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 |
果然如此,下面羅列一些類似問題(無法啟動)的解決思路:
1.可能是datadir目錄存在的分區(qū)滿了(df -h )
解決方法:打開配置文件/etc/my.cnf,在[mysqld]節(jié)下重新指定數(shù)據(jù)目錄(datadir),并將原來的數(shù)據(jù)目錄遷移到重新制定的數(shù)據(jù)目錄處
關于遷移:(1)、cp或者tar的時候一定要把權限給帶上,但是為防止意外建議再授權一次;(2)、數(shù)據(jù)比較大時一定要先壓縮再遷移,保證完整性,特別是scp到其他機器時可能會超時所以一定要壓縮(tar.gz);(3)、若是移動至另外的服務器一定要保證mysql版本一致。
2.可能是/mydata/data/fisheye.pid文件沒有寫的權限
解決方法 :給予權限,執(zhí)行 “chown -R mysql:mysql /mydata/data/” 然后重新啟動mysqld!
3.可能進程里已經(jīng)存在mysql進程
解決方法:用命令“ps -ef|grep mysqld”查看是否有mysqld進程,如果有使用“kill -9 進程號”殺死,然后重新啟動mysqld!
4.可能是第二次在機器上安裝mysql,有殘余數(shù)據(jù)影響了服務的啟動。
解決方法:去mysql的數(shù)據(jù)目錄/data看看,如果存在mysql-bin.index,就趕快把它刪除掉吧,它就是罪魁禍首了。
5.skip-federated字段問題(報錯信息:[ERROR] /mydata/data/mysql/libexec/mysqld: unknown option '--skip-federated')
解決方法:檢查一下/etc/my.cnf文件中有沒有沒被注釋掉的skip-federated字段,如果有就立即注釋掉吧。
6.selinux惹的禍,如果是centos系統(tǒng),默認會開啟selinux
解決方法:關閉它,打開/etc/selinux/config,把SELINUX=enforcing改為SELINUX=disabled后存盤退出重啟機器試試。
備份失敗
說明
執(zhí)行 mysqldump 時出現(xiàn)找不到某一個 tables 并且中斷執(zhí)行?及鎖表后延伸出現(xiàn)的問題記錄!
問題及方案如下
Error Meaage: 執(zhí)行mysqldump 時出現(xiàn)找不到某一個 tables 并且中斷執(zhí)行
1
|
[root@test100 data] # mysqldump fx > fx.sql |
1
|
mysqldump: Got error: 1146: Table 'user_suggest_report' doesn't exist when using LOCK TABLES |
考慮加上 --skip-lock-tables或者-R進行鎖表試試,也是不行,信息如下
1
|
[root@test100 data] #mysqldump --skip-lock-tables fx > fx.sql |
1
|
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) |
登陸服務器查看是否存在此表
1
2
|
[root@test100 data] #mysql -h127.0.0.1 -D fx mysql> show tables; #查看所有的表 --> 發(fā)現(xiàn)是表存在的 |
1
2
3
4
5
6
|
+--------------------------------+ | Tables_in_fx | +--------------------------------+ | user_suggest_report | +--------------------------------+ 80 rows in set (0.00 sec) |
刪除此表
1
|
mysql> drop table user_suggest_report; #既然是存在的,但是系統(tǒng)卻認定不存在說明存在問題,索性想刪除試試 |
1
|
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存儲目錄下將其數(shù)據(jù)表移動或刪除
1
2
3
4
|
[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服務器
1
|
[root@test100 fx] # service mysqld restart |
重新備份操作
1
|
[root@test100 data] # mysqldump fx > fx.150109.sql #操作成功 |