Couldn’t execute ‘SHOW VARIABLES LIKE ‘gtid\_mode”: Table ‘performance_schema.session_variables’ doesn’t exist (1146) – How to Fix

By | March 7, 2019

This issue is related to MySQL upgrade, when some table data was not updated to new format. When you try to run mysqldump or any other command, you can get this error. So let’s fix it, you’ll need root access or any other account with same privileges (if you are using Directadmin, this user might be da_admin).

First, we need to run mysql_upgrade. In my sample on a Directadmin server da_admin is used.

mysql_upgrade -uda_admin -p

Of course, you need to have your da_admin or root password ready as it will be requested.

The command above will inspect mysql for outdated tables and will create some fixing queries. You can get an error like this during this process:

Upgrade process completed successfully.
Could not create the upgrade info file '/var/lib/mysql/mysql_upgrade_info' in the MySQL Servers datadir, errno: 13

In order to solve this, you should create this file and give read/write access to it.

touch /var/lib/mysql/mysql_upgrade_info;
chmod 0777 /var/lib/mysql/mysql_upgrade_info;

and then restart the mysql_upgrade command.

If everything is fine, your output should look like this:

Upgrade process completed successfully.
Checking if update is needed.

It’s time to restart MySQL.

service mysqld restart

You’re done. Everything should be working at this point.

Leave a Reply

Your email address will not be published. Required fields are marked *