Mysql

用 MariaDB 10.0 替換 mySQL 5.7 後,mysql_upgrade 在事件調度程序中失敗

  • December 1, 2016

我在 Ubuntu 16.04 伺服器上用 MariaDB 10.0 替換了 mySQL 5.7。我在安裝之前使用 mysqldump 備份了數據庫。在 MariaDB 安裝期間,它說存在“標誌文件”意味著 DB 不是二進制兼容的,所以我在安裝後恢復了備份。MariaDB 不喜歡我的權限表,所以我嘗試執行 mysql_upgrade。這是輸出日誌(僅包含完整的詳細資訊和系統表):

root@server:~# mysql_upgrade --force -s -vvv
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
The --upgrade-system-tables option was used, user tables won't be touched.
Phase 1/6: Checking and upgrading mysql database
Running 'mysqlcheck with default connection arguments
# Connecting to localhost...
# Disconnecting from localhost...
Processing databases
mysql
CHECK TABLE `column_stats`  FOR UPGRADE
mysql.column_stats                                 OK
CHECK TABLE `columns_priv`  FOR UPGRADE
mysql.columns_priv                                 OK
CHECK TABLE `db`  FOR UPGRADE
mysql.db                                           OK
CHECK TABLE `engine_cost`  FOR UPGRADE
mysql.engine_cost                                  OK
CHECK TABLE `event`  FOR UPGRADE
mysql.event                                        OK
CHECK TABLE `event_old`  FOR UPGRADE
mysql.event_old                                    OK
CHECK TABLE `func`  FOR UPGRADE
mysql.func                                         OK
CHECK TABLE `gtid_executed`  FOR UPGRADE
mysql.gtid_executed                                OK
CHECK TABLE `gtid_slave_pos`  FOR UPGRADE
mysql.gtid_slave_pos                               OK
CHECK TABLE `help_category`  FOR UPGRADE
mysql.help_category                                OK
CHECK TABLE `help_keyword`  FOR UPGRADE
mysql.help_keyword                                 OK
CHECK TABLE `help_relation`  FOR UPGRADE
mysql.help_relation                                OK
CHECK TABLE `help_topic`  FOR UPGRADE
mysql.help_topic                                   OK
CHECK TABLE `host`  FOR UPGRADE
mysql.host                                         OK
CHECK TABLE `index_stats`  FOR UPGRADE
mysql.index_stats                                  OK
CHECK TABLE `innodb_index_stats`  FOR UPGRADE
mysql.innodb_index_stats                           OK
CHECK TABLE `innodb_table_stats`  FOR UPGRADE
mysql.innodb_table_stats                           OK
CHECK TABLE `ndb_binlog_index`  FOR UPGRADE
mysql.ndb_binlog_index                             OK
CHECK TABLE `plugin`  FOR UPGRADE
mysql.plugin                                       OK
CHECK TABLE `proc`  FOR UPGRADE
mysql.proc                                         OK
CHECK TABLE `procs_priv`  FOR UPGRADE
mysql.procs_priv                                   OK
CHECK TABLE `proxies_priv`  FOR UPGRADE
mysql.proxies_priv                                 OK
CHECK TABLE `roles_mapping`  FOR UPGRADE
mysql.roles_mapping                                OK
CHECK TABLE `server_cost`  FOR UPGRADE
mysql.server_cost                                  OK
CHECK TABLE `servers`  FOR UPGRADE
mysql.servers                                      OK
CHECK TABLE `slave_master_info`  FOR UPGRADE
mysql.slave_master_info                            OK
CHECK TABLE `slave_relay_log_info`  FOR UPGRADE
mysql.slave_relay_log_info                         OK
CHECK TABLE `slave_worker_info`  FOR UPGRADE
mysql.slave_worker_info                            OK
CHECK TABLE `table_stats`  FOR UPGRADE
mysql.table_stats                                  OK
CHECK TABLE `tables_priv`  FOR UPGRADE
mysql.tables_priv                                  OK
CHECK TABLE `time_zone`  FOR UPGRADE
mysql.time_zone                                    OK
CHECK TABLE `time_zone_leap_second`  FOR UPGRADE
mysql.time_zone_leap_second                        OK
CHECK TABLE `time_zone_name`  FOR UPGRADE
mysql.time_zone_name                               OK
CHECK TABLE `time_zone_transition`  FOR UPGRADE
mysql.time_zone_transition                         OK
CHECK TABLE `time_zone_transition_type`  FOR UPGRADE
mysql.time_zone_transition_type                    OK
CHECK TABLE `user`  FOR UPGRADE
mysql.user                                         OK
Phase 2/6: Fixing views... Skipped
Phase 3/6: Running 'mysql_fix_privilege_tables'
ERROR 1408 (HY000) at line 539: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
FATAL ERROR: Upgrade failed

如何解決事件調度程序問題以完成該過程?我必須 –skip-grant-tables 才能達到這一點,所以我很想解決這個問題,這樣我就可以以適當的權限執行伺服器。

我無法解決這個問題。

不過,我確實到達了我想去的地方:我用 啟動了伺服器--skip-grant-tables,備份了我想保留的每個數據庫,然後刪除了數據文件夾並執行mysql_install_db以創建系統表的新副本。我再次設置權限,然後重新導入數據庫。現在一切正常。

引用自:https://serverfault.com/questions/817427