If you are using Plesk and MySQL you may get a error while adding a MySQL database user to a database as
Error: Connection to the database server has failed:
Table ‘mysql.servers’ doesn’t exist
- To fix this error, SSH the server as a root user.
- Execute the command
[root@server ~]# mysql_fix_privilege_tables --user=admin --password=<admin password> --verbose
- On executing the above command, you should see following output
This script updates all the MySQL privilege tables to be usable by
the current version of MySQLERROR 1060 (42S21) at line 102: Duplicate column name 'File_priv'
ERROR 1060 (42S21) at line 108: Duplicate column name 'Grant_priv'
ERROR 1060 (42S21) at line 109: Duplicate column name 'Grant_priv'
ERROR 1060 (42S21) at line 110: Duplicate column name 'Grant_priv'
ERROR 1060 (42S21) at line 121: Duplicate column name 'ssl_type'
ERROR 1061 (42000) at line 131: Duplicate key name 'Grantor'
ERROR 1054 (42S22) at line 158: Unknown column 'Type' in 'columns_priv'
ERROR 1060 (42S21) at line 180: Duplicate column name 'type'
ERROR 1060 (42S21) at line 190: Duplicate column name 'Show_db_priv'
ERROR 1060 (42S21) at line 207: Duplicate column name 'max_questions'
ERROR 1060 (42S21) at line 217: Duplicate column name 'Create_tmp_table_priv'
ERROR 1060 (42S21) at line 220: Duplicate column name 'Create_tmp_table_priv'
ERROR 1060 (42S21) at line 345: Duplicate column name 'Create_view_priv'
ERROR 1060 (42S21) at line 348: Duplicate column name 'Create_view_priv'
ERROR 1060 (42S21) at line 351: Duplicate column name 'Create_view_priv'
ERROR 1060 (42S21) at line 357: Duplicate column name 'Show_view_priv'
ERROR 1060 (42S21) at line 360: Duplicate column name 'Show_view_priv'
ERROR 1060 (42S21) at line 363: Duplicate column name 'Show_view_priv'
ERROR 1060 (42S21) at line 380: Duplicate column name 'Create_routine_priv'
ERROR 1060 (42S21) at line 383: Duplicate column name 'Create_routine_priv'
ERROR 1060 (42S21) at line 386: Duplicate column name 'Create_routine_priv'
ERROR 1060 (42S21) at line 392: Duplicate column name 'Alter_routine_priv'
ERROR 1060 (42S21) at line 395: Duplicate column name 'Alter_routine_priv'
ERROR 1060 (42S21) at line 398: Duplicate column name 'Alter_routine_priv'
ERROR 1060 (42S21) at line 401: Duplicate column name 'Execute_priv'
ERROR 1060 (42S21) at line 404: Duplicate column name 'Execute_priv'
ERROR 1060 (42S21) at line 417: Duplicate column name 'max_user_connections'
ERROR 1060 (42S21) at line 426: Duplicate column name 'Create_user_priv'
ERROR 1060 (42S21) at line 448: Duplicate column name 'Routine_type'
ERROR 1054 (42S22) at line 573: Unknown column 'Event_priv' in 'where clause'
ERROR 1060 (42S21) at line 589: Duplicate column name 'sql_mode'
ERROR 1060 (42S21) at line 628: Duplicate column name 'originator'
ERROR 1060 (42S21) at line 632: Duplicate column name 'time_zone'
ERROR 1060 (42S21) at line 635: Duplicate column name 'character_set_client'
ERROR 1060 (42S21) at line 641: Duplicate column name 'collation_connection'
ERROR 1060 (42S21) at line 647: Duplicate column name 'db_collation'
ERROR 1060 (42S21) at line 653: Duplicate column name 'body_utf8'
ERROR 1054 (42S22) at line 663: Unknown column 'Trigger_priv' in 'where clause'
- Try to add a new database user now, you will be able to add a user without any issue.
This error generally occurs when MySQL is not upgraded successfully. Hence, you should fix the database privileges manually in this case.
If any feedback, queries are always welcome!