mysql从5.5直接升级到5.7后,执行mysql_upgrade速度很慢且执行结束后数据目录大小增加一倍及 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=mysql6、執行ssl相關操作
bin/mysql_ssl_rsa_setup7、啟動mysql
8、此時數據目錄還是5.5的,需要執行mysql_upgrade進行升級,在執行表修復前,需要確認一個參數innodb_file_per_table,mysql官網對該參數的解釋如下
該參數在5.5版本默認為OFF,所有表和索引都導入一個共享文件中,名為ibdata1,但在5.6.7及以后版本,改參數被默認設置為ON,即每張表都有對應的表和索引存儲文件,每個schema下,每個frm文件都有對應的ibd文件。
在執行mysql_upgrade時,會修復系統表,并且如果該參數在5.5和5.7版本均使用默認值,則會將之前共享表和索引的存儲方式改為每張表單獨存儲表和索引的形式,故會出現拷貝復制的操作,如果數據量比較大,則用時就會很長,
使用nnodb_file_per_table=1,及表和索引單獨存儲的優缺點,可查看mysql官網介紹。
9、使用mysql_upgrade檢測并修復表
使用方法與mysql命令登錄命令行一樣,mysql會自動檢測當前表并自動修復
mysql_upgrade -uroot -p10、修復完成后,若發現mysql啟動有server-key.pem相關的ssl錯誤,則是server-key.pem文件權限問題
chmod 644 server-key.pem11、但此時若執行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做深入了解
?
轉載于:https://www.cnblogs.com/qq931399960/p/10243758.html
總結
以上是生活随笔為你收集整理的mysql从5.5直接升级到5.7后,执行mysql_upgrade速度很慢且执行结束后数据目录大小增加一倍及 mysqlpump备份出现1577错误...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: QGLViewer 编译安装步骤
- 下一篇: hdu4565之矩阵快速幂