MySQL 8.0 mysql.user表顺坏修复【Windows】

发帖人 Admin 在 2023年10月06日 上

误操作导致用户表被覆盖,出现以下错误

2023-10-05T18:33:33.741728Z 0 [Warning] [MY-013143] [Server] Column count of mysql.user is wrong. Expected 51, found 37. The table is probably corrupted
2023-10-05T18:33:33.743602Z 0 [ERROR] [MY-010316] [Server] Fatal error: Could not read the column 'authentication_string' from table 'mysql.user'. Please perform the MySQL upgrade procedure.
2023-10-05T18:33:33.744537Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual.
2023-10-05T18:33:33.745770Z 0 [ERROR] [MY-010119] [Server] Aborting

修复

mysqld --defaults-file="C:/ProgramData/MySQL/MySQL Server 8.0/my.ini" --upgrade=FORCE

登录,修复用户表

mysqld --defaults-file="C:/ProgramData/MySQL/MySQL Server 8.0/my.ini" --console --skip-grant-tables --shared-memory