我在 Ubuntu 16.04 服务器上用 MariaDB 10.0 替换了 mySQL 5.7。我在安装前使用 mysqldump 备份了数据库。在 MariaDB 安装过程中,它说存在“标志文件”意味着数据库不兼容二进制文件,所以我在安装后恢复了备份。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 才能到达这一点,因此我当然渴望修复此问题,以便我能够以适当的权限运行服务器。
答案1
我无法解决这个问题。
不过,我确实做到了我想要的:我用 启动了服务器--skip-grant-tables
,备份了我想要保留的每个数据库,然后删除了数据文件夹并运行mysql_install_db
以创建新的系统表副本。我再次设置了权限,然后重新导入了数据库。现在一切都好了。