Table mysql.servers doesn’t exist: Problem adding a database user in plesk Or restarting mysql

 

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
This entry was posted on Saturday, August 21st, 2010 and is filed under Linux Administration. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

7 Responses to “Table mysql.servers doesn’t exist: Problem adding a database user in plesk Or restarting mysql”

  1. petr

    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

  2. admin

    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.

  3. Mohammad Raihan Mazumder

    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…???

  4. admin

    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.

  5. Eric Gillette

    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!

  6. 00designer

    Just to say that the Plesk solution worked perfectly. Thanks.

  7. Brent Maier

    This worked perfectly on Plesk 10.2 on CentOS 5.6. Thanks!