MySQL升级报错解决办法 - 开发说
当前位置: 主页 » MariaDB » MySQL升级报错解决办法

MySQL升级报错解决办法

      2022年03月05日   阅读 891 次     0 评论   Tags: ·

前两天看到MariaDB发布了10.8RC1就更新源把博客的MariaDB从10.7升级到10.8RC,博客正常访问,也没在意,今天发现VPS硬盘使用率大幅上升,然后就排查了一下,发现是MariaDB错误日志比较大。

1、排查思路:先用du -h统计磁盘使用率,再用 du -h --max-depth / 逐级定位文件和目录,发现是MariaDB错误日志比较大,然后用tail -n 10 error_log.err ,查看日志,避免数据量太大刷屏。

# 错误日志如下:原因:估计是升级了 MySQL 的软件包,管理数据库的某些表结构发生了变化,所以还需要升级数据库的相关表结构。



2022-03-05  9:33:37 43898 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'hist_type' at position 9 to have type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB','JSON_HB'), found type enum('SINGLE_PREC_HB','DOUBLE_PREC_HB').
2022-03-05  9:33:37 43898 [ERROR] Incorrect definition of table mysql.column_stats: expected column 'histogram' at position 10 to have type longblob, found type varbinary(255).

2、使用mysql_upgrade -u root -p 进行数据库修复。


[root@CLOUD-ORI-OVH-US-1 mysql]# mysql_upgrade -u root -p
Enter password: 
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats                                 OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.global_priv                                  OK
mysql.gtid_slave_pos                               OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.index_stats                                  OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.roles_mapping                                OK
mysql.servers                                      OK
mysql.table_stats                                  OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.transaction_registry                         OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
mysql.user                                         OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
performance_schema
sys
sys.sys_config                                     OK
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK

3、修复完成后MariaDB错误日志不在增加,网站访问也正常,至此错误解决。

  • 版权声明:本文版权归开发说和原作者所有,未经许可不得转载。文章部分来源于网络仅代表作者看法,如有不同观点,欢迎进行交流。除非注明,文章均由 开发说 整理发布,欢迎转载,转载请带版权。

  • 来源:开发说 ( https://www.kaifashuo.com/ ),提供主机优惠信息深度测评和服务器运维编程技术。
  • 链接:https://www.kaifashuo.com/2319.html
  • 评论(0

    1. 还没有任何评论,你来说两句吧

    发表回复

    您的电子邮箱地址不会被公开。 必填项已用 * 标注