MySQL 本机表'performance_schema'。'???' 结构错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6288103/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 20:11:41  来源:igfitidea点击:

Native table 'performance_schema'.'???' has the wrong structure

mysql

提问by P Hemans

I am getting the following:

我得到以下信息:

Native table 'performance_schema'.'file_instances' has the wrong structure
Native table 'performance_schema'.'cond_instances' has the wrong structure
Native table 'performance_schema'.'rwlock_instances' has the wrong structure
Native table 'performance_schema'.'mutex_instances' has the wrong structure
...

And on it goes These errors come up when I restart MySql. It seems to cause MySql Administrator to become unstable, I get a lot of:

当我重新启动 MySql 时,就会出现这些错误。似乎导致MySql Administrator变得不稳定,我得到了很多:

"MySQL server has gone away"

采纳答案by AhmetB - Google

Apparently MySQL schema storage is broken due to a reason. These reasons may be:

显然 MySQL 模式存储由于某种原因而损坏。这些原因可能是:

  • You have broken the database information_schema
  • File system corrupted or some bugs in the file system damaged the database.
  • MySQL internals broke the schema database due to a bug in MySQL (maybe nobody encountered it before).
  • 你破坏了数据库 information_schema
  • 文件系统损坏或文件系统中的某些错误损坏了数据库。
  • 由于 MySQL 中的一个错误,MySQL 内部破坏了模式数据库(可能之前没有人遇到过)。

If you don't have backups however you are still able to access your data, first backup your data then do the following:

如果您没有备份,但您仍然可以访问您的数据,请先备份您的数据,然后执行以下操作:

If you have backups, then reinstall MySQL (before that completely clear all data of mysql) and then import your data.

如果您有备份,则重新安装MySQL(在此之前完全清除mysql的所有数据),然后导入您的数据。

回答by Musa

Try following command in shell (the root user here is the mysql root user, not the system root)

尝试在shell中执行以下命令(这里的root用户是mysql root用户,而不是系统root)

sudo mysql_upgrade -u root -p

sudo service mysql restart

Make sure to restart mysqlafter running this (All credit to @Mikepote in the comments.)

确保在运行后重新启动 mysql(注释中的所有功劳都归功于@Mikepote。)

回答by Alexander Yanovets

Im my case it appeared when specific query was run on a table.

我的情况是在表上运行特定查询时出现。

And log also contained:

并且日志还包含:

Missing system table mysql.proxies_priv; please run mysql_upgrade to create it

缺少系统表 mysql.proxies_priv;请运行 mysql_upgrade 来创建它

I've run mysql_upgradeand after that problem has gone.

我已经运行了mysql_upgrade并且在那个问题消失之后。

回答by mkaatman

I had this problem, the answer was here by @Berend de Boer

我遇到了这个问题,@Berend de Boer 给出了答案

Restart mysql after the upgrade.

升级后重启mysql。

[ERROR]Native table performance schema has the wrong structure

[ERROR]本机表性能模式结构错误

回答by wens

This error is encountered when you installed MySQL over a previous installation that was configured without the Performance Schema or an older version of Performance schema that may not have all the current tables.

当您在没有 Performance Schema 或可能没有所有当前表的旧版本 Performance 架构的先前安装上安装 MySQL 时,会遇到此错误。

I also encountered this issue on mamp. To resolve it, I have executed the following:

我也在mamp上遇到了这个问题。为了解决它,我执行了以下操作:

cd /Applications/MAMP/bin/
sudo ./upgradeMysql.sh 

Remember to restart the mysql server.

记得重启mysql服务器。

You can read the Performance Schema Build Configurationfor more details.

您可以阅读性能架构构建配置以获取更多详细信息。

回答by user1960812

If the database is a Akonadi (KDE) database the above won't be enough. You need to mirror the options given to your mysqld, check with

如果数据库是 Akonadi (KDE) 数据库,以上内容是不够的。您需要镜像提供给 mysqld 的选项,请检查

ps aux | grep mysql

Copy the options to the mysql_upgrade commands (I did not need '-u root -p' but you might)

将选项复制到 mysql_upgrade 命令(我不需要 '-u root -p' 但你可能需要)

mysql_upgrade --defaults-file=/home/USER/.local/share/akonadi/mysql.conf --datadir=/home/USER/.local/share/akonadi/db_data/ --socket=/tmp/akonadi-USER.x0Bvxr/mysql.socket

I really think the --socket option is the key.

我真的认为 --socket 选项是关键。

回答by Alailson Ribeiro

Try mysql_upgradeand then restart mysql and its working back

尝试mysql_upgrade然后重新启动 mysql 及其工作

回答by Baharuni Asif

It seems this happens after you have done upgrade. Simply restart mysql:

升级完成后似乎会发生这种情况。只需重新启动mysql:

Like run below command in CMD

就像在 CMD 中运行下面的命令一样

sudo mysql_upgrade -u root -p

service mysql restart

and the error should now have disappeared.

并且错误现在应该已经消失了。