原来这个样子的:
MariaDB [(none)]> select user();
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
MariaDB [(none)]> show grants for root@localhost;
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*FF3FB6E7BE54C3D2E0DEEBD962EF6F5FA4E148DA' WITH GRANT OPTION |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
MariaDB [(none)]>
修复方法执行 mysql_upgrade -u root -p 升级。
参考文章:https://www.douban.com/note/311849800/
[root@pfdb01 ~]# mysql_upgrade -u root -p
Enter password:
MySQL upgrade detected
Phase 1/4: Fixing views from mysql
Phase 2/4: Fixing table and database names
Phase 3/4: Checking and upgrading tables
Processing databases
information_schema
mysql
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.servers OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
pf
pf.action OK
pf.activation OK
pf.billing OK
pf.class OK
pf.configfile OK
pf.ifoctetslog OK
pf.inline_accounting OK
pf.iplog OK
pf.iplog_archive OK
pf.iplog_history OK
pf.keyed OK
pf.locationlog OK
pf.locationlog_archive OK
pf.node OK
pf.node_category OK
pf.node_useragent OK
pf.password OK
pf.person OK
pf.pf_version OK
pf.radacct OK
pf.radacct_log OK
pf.radius_nas OK
pf.savedsearch OK
pf.scan OK
pf.sms_carrier OK
pf.soh_filter_rules OK
pf.soh_filters OK
pf.traplog OK
pf.trigger OK
pf.userlog OK
pf.violation OK
pf.wrix OK
pf_graphite
pf_graphite.account_mygraph OK
pf_graphite.account_profile OK
pf_graphite.account_variable OK
pf_graphite.account_view OK
pf_graphite.account_window OK
pf_graphite.auth_group OK
pf_graphite.auth_group_permissions OK
pf_graphite.auth_permission OK
pf_graphite.auth_user OK
pf_graphite.auth_user_groups OK
pf_graphite.auth_user_user_permissions OK
pf_graphite.dashboard_dashboard OK
pf_graphite.dashboard_dashboard_owners OK
pf_graphite.django_admin_log OK
pf_graphite.django_content_type OK
pf_graphite.django_session OK
pf_graphite.events_event OK
pf_graphite.tagging_tag OK
pf_graphite.tagging_taggeditem OK
test
Phase 4/4: Running 'mysql_fix_privilege_tables'
OK
[root@pfdb01 ~]#
[root@pfdb01 ~]#
修复后应该是这个样子的:
[root@pfdb01 ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 17
Server version: 5.5.48-MariaDB-wsrep MariaDB Server, wsrep_25.14.r9949137
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show grants for root@localhost;
+----------------------------------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost |
+----------------------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*FF3FB6E7BE54C3D2E0DEEBD962EF6F5FA4E148DA' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION |
+----------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
MariaDB [(none)]>
本文转自Tenderrain 51CTO博客,原文链接:http://blog.51cto.com/tenderrain/1751216,如需转载请自行联系原作者