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

Posted by admin     Category: Linux Administration

 

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 server is upgraded from an older to a newer version and the upgrade remains incomplete. Since Mysql often introduces new tables with the newer versions, you need to run the “mysql_fix_privilege_tables” script located in the “/usr/bin/” directory so the mysql database is updated with the latest contents thus fixing the privileges of the database users as well.

Section 1:

To fix the issue, SSH to your server as root and execute the command:

On a plain Linux OR Linux/cPanel server:

# mysql_fix_privilege_tables --user=root --password=<mysql password here> --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:

If mysql_fix_privilege_tables command does not exist, use mysql_upgrade instead.  mysql_fix_privilege_tables is an older script that previously was used to uprade the system tables in the mysql database after a MySQL upgrade.  mysql_upgrade command have superseded mysql_fix_privilege_tables.

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=<mysql password here> --verbose

On a Linux/Plesk server:

# mysql_upgrade --user=admin --password=`cat /etc/psa/.psa.shadow` --verbose

Tags: , , , , , , ,

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

  1. petr Says:

    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 Says:

    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 Says:

    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 Says:

    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 Says:

    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 Says:

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

  7. Brent Maier Says:

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

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image