MySQL下常見的啟動失敗與備份失敗問題的解決教程
啟動失敗
重啟服務器后-->重啟應用服務(Confluence)-->報錯,數(shù)據(jù)庫連接失?。╩ysql設置了開機自啟動)-->查看mysql數(shù)據(jù)庫狀態(tài):
[root@fisheye ~]# ps -ef | grep mysql root 25555 21974 0 11:28 pts/0 00:00:00 grep mysql
啟動mysql服務器
[root@fisheye data]# service mysql start
MySQL server PID file could not be found![失敗] Starting MySQL.............. ERROR! The server quit without updating PID file (/mydata/data/fisheye..pid).[失敗]
查看錯誤日志:
[root@fisheye data]# tail -100 fisheye.err
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文件試試
[root@fisheye data]# touch /mydata/data/fisheye.pi
再進行重啟服務:
[root@fisheye data]# service mysql restart
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
突然想到之前看過此類報錯的文章,記得有可能是磁盤空間不足導致的mysql無法啟動。
[root@fisheye data]# df -h
(文件系統(tǒng) 容量 已用 可用 已用% 掛載點)
/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í)行
[root@test100 data]# mysqldump fx > fx.sql
mysqldump: Got error: 1146: Table 'user_suggest_report' doesn't exist when using LOCK TABLES
考慮加上 --skip-lock-tables或者-R進行鎖表試試,也是不行,信息如下
[root@test100 data]#mysqldump --skip-lock-tables fx > fx.sql
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)
登陸服務器查看是否存在此表
[root@test100 data]#mysql -h127.0.0.1 -D fx mysql> show tables; #查看所有的表 --> 發(fā)現(xiàn)是表存在的
+--------------------------------+ | Tables_in_fx | +--------------------------------+ | user_suggest_report | +--------------------------------+ 80 rows in set (0.00 sec)
刪除此表
mysql> drop table user_suggest_report; #既然是存在的,但是系統(tǒng)卻認定不存在說明存在問題,索性想刪除試試
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ù)表移動或刪除
[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服務器
[root@test100 fx]# service mysqld restart
重新備份操作
[root@test100 data]# mysqldump fx > fx.150109.sql #操作成功
相關文章
MySQL中int(10)和int(11)的區(qū)別詳解
本文主要介紹了MySQL中int(10)和int(11)的區(qū)別詳解,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2023-03-03MySQL與PHP的基礎與應用專題之數(shù)據(jù)完整性
MySQL是一個關系型數(shù)據(jù)庫管理系統(tǒng),由瑞典MySQL?AB?公司開發(fā),屬于?Oracle?旗下產(chǎn)品。MySQL?是最流行的關系型數(shù)據(jù)庫管理系統(tǒng)之一,本系列將帶你掌握php與mysql的基礎應用,本篇從數(shù)據(jù)完整性開始2022-02-02使用Mysql5.x以上版本出現(xiàn)報錯#1929 Incorrect datetime value: '''''''' f
我的MySQL安裝后,保存刪除表數(shù)據(jù)總是出現(xiàn)#1929 Incorrect datetime value: '' for column 'createtime' 的報錯提醒,導致不能刪除表里數(shù)據(jù)。下面小編給大家分析原因及解決辦法,需要的朋友可以參考下2017-01-01Mysql報Table?'mysql.user'?doesn't?exist問題的解
這篇文章主要給大家介紹了關于Mysql報Table?'mysql.user'?doesn't?exist問題的解決方法,初學者可能會遇到這個問題,文中通過圖文將解決方法介紹的非常詳細,需要的朋友可以參考下2022-05-05