mysqldump失敗案例及解決:
1.mysqldump: Error 2020: Got packet bigger than 'max_allowed_packet' bytes when dumping table `blt_bulletinannex` at row: 626
報錯條件:一般是存在blob,text等字段,單條記錄超過默認的24M
解決措施:mysqldump調大max_allow_packet參數,在服務器端修改這個參數無效
2.mysqldump: Couldn't execute 'show table status like 'members\_ban\_user\_view'': SELECT command denied to user ''@'%' for column 'user_id' in table 'members_ban_log' (1143)
報錯條件:相應的視圖的賬戶給的權限不足;或者是用戶不存在
解決措施:需要視圖定義賬戶的Create_view_priv和Show_view_priv權限;或者添加對應的用戶和權限;刪除該視圖
3.mysqldump: Couldn't execute 'show create table `innodb_index_stats`': Table 'MySQL.innodb_index_stats' doesn't exist (1146)
報錯條件:mysql5.6,系統表損壞,該表是innodb引擎
解決措施:物理刪除該表的frm文件和ibd文件,找到系統表的定義sql,重建系統表
4.mysqldump: Couldn't execute 'show create table `view_all_packages`': View 'locker.view_all_packages' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (1356)
報錯條件:視圖定義不合法
解決措施:刪除或修改出問題的視圖定義語句
5.mysqldump: Got error: 1045: Access denied for user 'ucloudbackup'@'10.10.1.242' (using password: YES) when trying to connect
報錯條件:無法連接,密碼,賬戶,host,port有問題
解決措施:先保證mysql能正常連接
6.mysqldump: Couldn't execute 'show create table `userarenalog`': Table './tank_11/userarenalog' is marked as crashed and should be repaired (145)
報錯條件:myisam表損壞
解決措施:repair table XXX修復損壞的表,最好mysqlcheck一下所有表
7.mysqldump: Couldn't execute 'show fields from `TB_CROWDFUNDING_PROJECT`': Incorrect key file for table 'ql-5.5/14310da6-644a-472a-b170-0e7e75cfda87/tmp/#sql_32606_0.MYI'; try to repair it (126)
報錯條件:臨時表使用過程中/tmp空間不足,導致myisam臨時表損壞
解決措施:增大磁盤空間就好
8.mysqldump: Couldn't execute 'SHOW FUNCTION STATUS WHERE Db = 'analysis'': Cannot load from mysql.proc. The table is probably corrupted (1548)
報錯條件:升級導致
解決措施:運行mysql_upgrade更新db,或者更新對應版本的mysql.proc表結構
5.1執行
alter table mysql.proc MODIFY COLUMN `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL AFTER `sql_mode`;
5.5執行
alter table mysql.proc MODIFY COLUMN `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL AFTER `sql_mode`;
9.mysqldump: Couldn't execute 'show events': Cannot proceed because system tables used by Event Scheduler were found damaged at server start (1577)
報錯原因:不合理的升級mysql版本導致
解決措施:先mysql_upgrade,不行再重啟db看看(不大確定)
10.mysqldump: Couldn't execute 'SHOW FUNCTION STATUS WHERE Db = 'mysql'': 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 '' at line 1 (1064)
報錯原因:select * from information_schema.ROUTINES limit 1報一樣的錯誤
再查看mysql.proc表發現有函數或者存儲過程定義有問題,比如根本不存在的db或者user出現在定義中,猜測是備份時沒有加-R參數,直接導入到db后沒有正常建立對應的函數或存儲過程導致的
解決措施:先嘗試drop語法刪除mysql.proc中定義有問題的函數或存儲過程記錄,如果不行就直接delete from的方式刪除
11.mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `vitality_flow` at row: 31961089
報錯原因:1 該表是分區表 2 該表是innodb,存在大量的blob text等字段 3 上傳NFS或者邊備份邊壓縮
解決措施:針對1和3的原因,需要調大net_write_timeout參數;針對2的原因,需要調大max_allow_packet;
12.mysqldump: Couldn't execute 'SELECT DISTINCT TABLESPACE_NAME, FILE_NAME, LOGFILE_GROUP_NAME, EXTENT_SIZE, INITIAL_SIZE, ENGINE FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE = 'DATAFILE' AND TABLESPACE_NAME IN (SELECT DISTINCT TABLESPACE_NAME FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA IN ('15616156','mysql','test','wx00','wx01','wx02','wx03','wxid')) ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME': Lost connection to MySQL server during query (2013)
報錯原因:備份過程中因內存不足而oom
解決措施:加大內存
13.mysqldump: Couldnt execute show create table `shop_his_9`: Deadlock found when trying to get lock; try restarting transaction (1213) fails
報錯原因:mysqldump過程中發生死鎖
解決措施:重試即可
14.mysqldump: Got error: 1049: Unknown database cfcara when selecting the database fails
報錯原因:隨意修改大小寫敏感問題導致
解決措施:先解決大小寫問題
mysqldump: Couldn't execute 'STOP SLAVE SQL_THREAD': Access denied for user 'root'@'172.19.%.%' (using password: NO) (1045)
報錯原因:從庫備份,備份賬戶權限不足,無法登陸
mysqldump: Couldnt execute show create table `sk_order_38`: Unable to open underlying table which is differently defined or of non-MyISAM type or doesnt exist (1168) fails |
報錯原因:mrg表定義出錯導致的吧
解決措施:把這個表刪除
原文blog:
http://blog.csdn.net/cug_jiang126com/article/details/49359699