Many times after compiling mysql to newer version, mysql always quitting with an error Table ‘mysql.servers’ doesn’t exist during flush privileges command. Apparently this issue arises sometimes with an incomplete MySQL upgrade. Beyond just installing new binaries you’ll often need to run mysql_fix_privilege_tables command to ensure the ‘mysql’ database contains all the needed stuff.
{code type=css}[root@jfserver1 ~]# mysql_fix_privilege_tables –user=root –password=<root-pwd> –verbose
This script updates all the mysql privilege tables to be usable by
the current version of MySQL
You can safely ignore all ‘Duplicate column’ and ‘Unknown column’ errors
because these just mean that your tables are already up to date.
This script is safe to run even if your tables are already up to date!
ERROR 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 328: Duplicate column name ‘Create_view_priv’
ERROR 1060 (42S21) at line 331: Duplicate column name ‘Create_view_priv’
ERROR 1060 (42S21) at line 334: Duplicate column name ‘Create_view_priv’
ERROR 1060 (42S21) at line 340: Duplicate column name ‘Show_view_priv’
ERROR 1060 (42S21) at line 343: Duplicate column name ‘Show_view_priv’
ERROR 1060 (42S21) at line 346: Duplicate column name ‘Show_view_priv’
ERROR 1060 (42S21) at line 363: Duplicate column name ‘Create_routine_priv’
ERROR 1060 (42S21) at line 366: Duplicate column name ‘Create_routine_priv’
ERROR 1060 (42S21) at line 369: Duplicate column name ‘Create_routine_priv’
ERROR 1060 (42S21) at line 375: Duplicate column name ‘Alter_routine_priv’
ERROR 1060 (42S21) at line 378: Duplicate column name ‘Alter_routine_priv’
ERROR 1060 (42S21) at line 381: Duplicate column name ‘Alter_routine_priv’
ERROR 1060 (42S21) at line 384: Duplicate column name ‘Execute_priv’
ERROR 1060 (42S21) at line 387: Duplicate column name ‘Execute_priv’
ERROR 1060 (42S21) at line 400: Duplicate column name ‘max_user_connections’
ERROR 1060 (42S21) at line 409: Duplicate column name ‘Create_user_priv’
ERROR 1060 (42S21) at line 431: Duplicate column name ‘Routine_type’
ERROR 1060 (42S21) at line 499: Duplicate column name ‘character_set_client’
ERROR 1060 (42S21) at line 505: Duplicate column name ‘collation_connection’
ERROR 1060 (42S21) at line 511: Duplicate column name ‘db_collation’
ERROR 1060 (42S21) at line 517: Duplicate column name ‘body_utf8’
ERROR 1060 (42S21) at line 528: Duplicate column name ‘Event_priv’
ERROR 1060 (42S21) at line 533: Duplicate column name ‘Event_priv’
ERROR 1060 (42S21) at line 542: Duplicate column name ‘sql_mode’
ERROR 1060 (42S21) at line 581: Duplicate column name ‘originator’
ERROR 1060 (42S21) at line 585: Duplicate column name ‘time_zone’
ERROR 1060 (42S21) at line 588: Duplicate column name ‘character_set_client’
ERROR 1060 (42S21) at line 594: Duplicate column name ‘collation_connection’
ERROR 1060 (42S21) at line 600: Duplicate column name ‘db_collation’
ERROR 1060 (42S21) at line 606: Duplicate column name ‘body_utf8’
ERROR 1060 (42S21) at line 618: Duplicate column name ‘Trigger_priv’
ERROR 1060 (42S21) at line 621: Duplicate column name ‘Trigger_priv’
ERROR 1060 (42S21) at line 624: Duplicate column name ‘Trigger_priv’
done
[root@jfserver1 ~]# mysql -uroot -p -e “flush privileges”
Enter password:
[root@jfserver1 ~]#{/code}
As you may see, always flush privileges to test the table is already fix.
Have fun.