CarbonMan
CarbonMan

Reputation: 4490

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

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 server has gone away"

Upvotes: 79

Views: 110874

Answers (8)

Musa
Musa

Reputation: 4024

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

sudo mysql_upgrade -u root -p

sudo service mysql restart

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

Upvotes: 250

Baharuni Asif
Baharuni Asif

Reputation: 325

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

Like run below command in CMD

sudo mysql_upgrade -u root -p

service mysql restart

and the error should now have disappeared.

Upvotes: 0

wonu wns
wonu wns

Reputation: 3608

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.

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

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

Remember to restart the mysql server.

You can read the Performance Schema Build Configuration for more details.

Upvotes: 8

Alailson Ribeiro
Alailson Ribeiro

Reputation: 3

Try mysql_upgrade and then restart mysql and its working back

Upvotes: 0

Matt
Matt

Reputation: 5428

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

Restart mysql after the upgrade.

[ERROR]Native table performance schema has the wrong structure

Upvotes: 19

user1960812
user1960812

Reputation: 21

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

ps aux | grep mysql

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

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.

Upvotes: 2

Oleksandr Yanovets
Oleksandr Yanovets

Reputation: 4667

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

I've run mysql_upgrade and after that problem has gone.

Upvotes: 24

ahmet alp balkan
ahmet alp balkan

Reputation: 45302

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

  • 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).

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.

Upvotes: -3

Related Questions