Update: If “mysql_fix_privilege_tables” command does not exist, look at Section 2.
You may receive a “Table ‘mysql.servers’ doesn’t exist” error message while adding a database user in Plesk OR while restarting the Mysql service. The complete error message look like:
Error: Connection to the database server has failed: Table 'mysql.servers' doesn't exist
OR
Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
The problem mostly occurs when Mysql is upgraded which introduce newer version of tables and the default Mysql database is not aware of these changes. The “mysql_fix_privilege_tables” command is use to update the Mysql database with the latest contents of the newer version and to fix the privileges of the database users as well.
Section 1:
To fix the issue, SSH to your server and execute:
On a plain Linux OR Linux/cPanel server:
# mysql_fix_privilege_tables --user=root\ --password=mysqlpasswordhere --verbose
On a Linux/Plesk server:
# mysql_fix_privilege_tables --user=admin\ --password=`cat /etc/psa/.psa.shadow` --verbose
where, –verbose will display the detailed output.
Section 2:
mysql_upgrade command have superseded mysql_fix_privilege_tables. mysql_fix_privilege_tables is an older script that previously was used to upgrade the system tables in the Mysql database .
To fix the issue, you need to replace mysql_fix_privilege_tables with mysql_upgrade in the above stated commands, i.e.
On a plain Linux OR Linux/cPanel server:
# mysql_upgrade --user=root --password=mysqlpasswordhere --verbose
On a Linux/Plesk server:
# mysql_upgrade --user=admin\ --password=`cat /etc/psa/.psa.shadow` --verbose
October 25th, 2010 at 9:21 am
Hi, thank you for help, but have still some problem … the command (for linux/plesk) doesnt work, can you help please ? :
# mysql_fix_privilege_tables -uxxx -pxxx-verbose
This script updates all the mysql privilege tables to be usable by the current version of MySQL
Got a failure from command:
cat /usr/share/mysql/mysql_fix_privilege_tables.sql | /usr/bin/mysql –no-defaults –force –user=root –host=localhost –database=mysql
Please check the above output and try again.
Running the script with the –verbose option may give you some information
of what went wrong.
If you get an ‘Access denied’ error, you should run this script again and
give the MySQL root user password as an argument with the –password= option
October 27th, 2010 at 9:43 am
On a Linux/Plesk server, you need to use the Plesk admin password in the command. You can also use the command as follows:
# mysql_fix_privilege_tables --user=admin --password=`cat /etc/psa/.psa.shadow` --verbose
This should definitely fix the problem.
March 13th, 2011 at 2:27 am
i hv problem & using captcha in my php registration form. but after fillup the registration form i got msg:
Table ‘raihanma_jogja.user’ doesn’t exist
user: raihanma_dhaka
Database: raihanma_jogja
i need solution. Can anybody help me…???
March 16th, 2011 at 9:11 am
Hello,
The error clearly indicates that the table ‘user’ does not exist in the “raihanma_jogja” database. Make sure you are using the correct database name, username/password. If they are correct, try installing the application again as the table may have not been created during the installation.
March 22nd, 2011 at 6:04 pm
Hi,
Thanks for the post!
I got this error message when trying to delete a domain in Plesk, and was stumped as to why the error was occurring.
Your suggestion fixed the problem!
Thanks a lot!
July 13th, 2011 at 12:18 pm
Just to say that the Plesk solution worked perfectly. Thanks.
September 16th, 2011 at 3:07 pm
This worked perfectly on Plesk 10.2 on CentOS 5.6. Thanks!