1. 程式人生 > >mysql從5.5直接升級到5.7 mysqlpump備份出現1577錯誤

mysql從5.5直接升級到5.7 mysqlpump備份出現1577錯誤

mysql官網不支援誇大版本升級,比如跳過5.6直接升級到5.7,但由於一些客觀原因,專案需要從5.5直接升級到5.7,以下是具體操作

1、備份之前mysql,(資料量少,可直接拷貝安裝目錄及data目錄和配置檔案,本例使用的為Percona XtraBackup工具進行的備份)

2、將data目錄移出mysql5.5安裝目錄

3、解壓mysql5.7版本

4、修改5.7需要配置檔案my.cnf,新增datadir,指向5.5資料目錄

5、初始化,該步驟可選,(新安裝資料庫,或者資料目錄不存在,可執行如下命令初始化資料目錄,本例中不需要執行如下操作)

bin/mysqld --initialize --user=mysql

6、執行ssl相關操作

bin/mysql_ssl_rsa_setup

7、啟動mysql

8、此時資料目錄還是5.5的,需要執行mysql_upgrade進行升級,使用方法與mysql命令登入命令列一樣,mysql會自動檢測當前表並自動修復

mysql_upgrade -uroot -p

9、修復完成後,若發現mysql啟動有server-key.pem相關的ssl錯誤,則是server-key.pem檔案許可權問題

chmod 644 server-key.pem

10、但此時若執行mysqlpum備份資料,可能會出現異常

mysqlpump --user=root --password mytest > mytest.sql

錯誤資訊:

mysqlpump: [ERROR] (1577) Cannot proceed because system tables used by Event Scheduler were found damaged at server start
Dump process encountered error and will not continue.
mysqlpump: [ERROR] (1577) Cannot proceed because system tables used by Event Scheduler were found damaged at server start
Dump process encountered error and will not 
continue. mysqlpump: [ERROR] (1577) Cannot proceed because system tables used by Event Scheduler were found damaged at server start Dump process encountered error and will not continue. mysqlpump: [ERROR] (1577) Cannot proceed because system tables used by Event Scheduler were found damaged at server start Dump process encountered error and will not continue. mysqlpump: [ERROR] (1577) Cannot proceed because system tables used by Event Scheduler were found damaged at server start Dump process encountered error and will not continue. mysqlpump: [ERROR] (1577) Cannot proceed because system tables used by Event Scheduler were found damaged at server start Dump process encountered error and will not continue. mysqlpump: [ERROR] (1577) Cannot proceed because system tables used by Event Scheduler were found damaged at server start Dump process encountered error and will not continue. mysqlpump: [ERROR] (1577) Cannot proceed because system tables used by Event Scheduler were found damaged at server start Dump process encountered error and will not continue. mysqlpump: [ERROR] (1577) Cannot proceed because system tables used by Event Scheduler were found damaged at server start Dump process encountered error and will not continue.

解決方法:重啟mysql服務 (本例中是這樣解決的問題)

重新執行mysqlpump

Dump progress: 1/28 tables, 0/353 rows
Dump progress: 36/343 tables, 0/19746 rows
Dump progress: 180/343 tables, 6151/19746 rows
Dump completed in 3675 milliseconds

資料被正確備份下來,且備份速度很快,從備份檔案可以看到,內容與mysqldump備份有很多不同

本次只是簡單嘗試mysqlpump,待後續再對mysqlpump做深入瞭解