Error Table performance_schema.session_status doesn’t exist
When trying to connect to MySQL database, you might run into this error:
SQL Error (1146): Table 'performance_schema.session_status' doesn't exist
The reason is likely that the database didn’t upgrade successfully and created version incompatible schemas for internal metadata, so the new MySQL version can’t read the old internal metadata and have to throw back the error message.
1. Run mysql_upgrade
To fix this, run mysql_upgrade
command. If mysql_upgrade finds that a table has a possible incompatibility, it performs a table check and, if problems are found, attempts a table repair.
Run this command from the MySQL Server:
mysql_upgrade -u root -p --force
Then restart MySQL Server:
systemctl restart mysqld
2. Turn on SHOW_COMPATIBILTY_56
For some cases after upgrading MySQL, the new version has the option SHOW_COMPATIBILTY_56
disabled by default. With the SHOW_COMPATIBILTY_56
system variable disabled, SHOW VARIABLES
and SHOW STATUS
statements failed if MySQL was compiled without Performance Schema support. Consequently, it is no longer to compile without the Performance Schema and cause the error.
First, you can check if it’s disabled:
SELECT @@SHOW_COMPATIBILTY_56;
If it’s off, the result will be:
@@SHOW_COMPATIBILTY_56 |
---|
0 |
Run this command to turn it on:
SET @@SHOW_COMPATIBILTY_56=ON;
Or you can edit the MySQL configuration file
SHOW_COMPATIBILTY_56 = 1
Need a good GUI tool for databases? TablePlus provides a native client that allows you to access and manage Oracle, MySQL, SQL Server, PostgreSQL, and many other databases simultaneously using an intuitive and powerful graphical interface.
Not on Mac? Download TablePlus for Windows.
On Linux? Download TablePlus for Linux
Need a quick edit on the go? Download TablePlus for iOS