mysql_upgrade

portupgrade -aした後のお話。

mysqlでgrantしようと思ったら

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

なんて怒られる。

パスワードは設定しているし、そもそもmysql monitorは-pオプション付きで起動している訳ですよ。

5.5.27に上がったしなぁとか思いながらgoogle先生に聞いてみたところ「mysql_upgrade」というコマンドがあるらしく。

※ see also. 「4.5.4. mysql_upgrade ? MySQL アップグレードのテーブル チェック

実行はコマンドラインから

# mysql_upgrade

とするだけ。

Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock'
mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) when trying to connect
FATAL ERROR: Upgrade failed

と怒られたら、

# mysql_upgrade -u root -p

の様にユーザを指定してとパスワードオプションを付けて実行すればOK。

実行すると、

# mysql_upgrade -u root -p
Enter password:パスワードを入力
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock'
Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/tmp/mysql.sock'
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  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.proxies_priv                                 OK
mysql.servers                                      OK
mysql.slow_log                                     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
pcshopdb.citycode                                  OK
pcshopdb.citycode_kana                             OK
pcshopdb.prefcode                                  OK
pcshopdb.spot                                      OK
pcshopdb.zipcode                                   OK
pcshopdb.zipcode_kana                              OK
pcshoppdnswordpressdb.wp_Counterize                OK
pcshoppdnswordpressdb.wp_Counterize_Keywords       OK
pcshoppdnswordpressdb.wp_Counterize_Pages          OK
pcshoppdnswordpressdb.wp_Counterize_Referers       OK
pcshoppdnswordpressdb.wp_Counterize_UserAgents     OK
pcshoppdnswordpressdb.wp_adrotate                  OK
pcshoppdnswordpressdb.wp_adrotate_blocks           OK
pcshoppdnswordpressdb.wp_adrotate_groups           OK
pcshoppdnswordpressdb.wp_adrotate_linkmeta         OK
pcshoppdnswordpressdb.wp_adrotate_stats_tracker    OK
pcshoppdnswordpressdb.wp_adrotate_tracker          OK
pcshoppdnswordpressdb.wp_commentmeta               OK
pcshoppdnswordpressdb.wp_comments                  OK
pcshoppdnswordpressdb.wp_links                     OK
pcshoppdnswordpressdb.wp_options                   OK
pcshoppdnswordpressdb.wp_postmeta                  OK
pcshoppdnswordpressdb.wp_posts                     OK
pcshoppdnswordpressdb.wp_postview                  OK
pcshoppdnswordpressdb.wp_similar_posts             OK
pcshoppdnswordpressdb.wp_term_relationships        OK
pcshoppdnswordpressdb.wp_term_taxonomy             OK
pcshoppdnswordpressdb.wp_terms                     OK
pcshoppdnswordpressdb.wp_usermeta                  OK
pcshoppdnswordpressdb.wp_users                     OK
pcshoppdnswordpressdb.wp_wassup                    OK
pcshoppdnswordpressdb.wp_wassup_meta               OK
pcshoppdnswordpressdb.wp_wassup_tmp                OK
pcshoppdnswordpressdb.wp_wpaa_cache                OK
urashikawordpressdb.wp_commentmeta                 OK
urashikawordpressdb.wp_comments                    OK
urashikawordpressdb.wp_links                       OK
urashikawordpressdb.wp_options                     OK
urashikawordpressdb.wp_postmeta                    OK
urashikawordpressdb.wp_posts                       OK
urashikawordpressdb.wp_term_relationships          OK
urashikawordpressdb.wp_term_taxonomy               OK
urashikawordpressdb.wp_terms                       OK
urashikawordpressdb.wp_usermeta                    OK
urashikawordpressdb.wp_users                       OK
urashikawordpressdb.wp_wassup                      OK
urashikawordpressdb.wp_wassup_meta                 OK
urashikawordpressdb.wp_wassup_tmp                  OK
wordpressDB.wp_Counterize                          OK
wordpressDB.wp_Counterize_Keywords                 OK
wordpressDB.wp_Counterize_Pages                    OK
wordpressDB.wp_Counterize_Referers                 OK
wordpressDB.wp_Counterize_UserAgents               OK
wordpressDB.wp_adrotate                            OK
wordpressDB.wp_adrotate_blocks                     OK
wordpressDB.wp_adrotate_groups                     OK
wordpressDB.wp_adrotate_linkmeta                   OK
wordpressDB.wp_adrotate_schedule                   OK
wordpressDB.wp_adrotate_stats_cache                OK
wordpressDB.wp_adrotate_stats_tracker              OK
wordpressDB.wp_adrotate_tracker                    OK
wordpressDB.wp_commentmeta                         OK
wordpressDB.wp_comments                            OK
wordpressDB.wp_contact_form_7                      OK
wordpressDB.wp_links                               OK
wordpressDB.wp_options                             OK
wordpressDB.wp_popularpostsdata                    OK
wordpressDB.wp_popularpostsdatacache               OK
wordpressDB.wp_postmeta                            OK
wordpressDB.wp_posts                               OK
wordpressDB.wp_similar_posts                       OK
wordpressDB.wp_term_relationships                  OK
wordpressDB.wp_term_taxonomy                       OK
wordpressDB.wp_terms                               OK
wordpressDB.wp_usermeta                            OK
wordpressDB.wp_users                               OK
wordpressDB.wp_wassup                              OK
wordpressDB.wp_wassup_meta                         OK
wordpressDB.wp_wassup_tmp                          OK
wordpressDB.wp_yarpp_keyword_cache                 OK
wordpressDB.wp_yarpp_related_cache                 OK
wordpressDB.wp_yo_amazon_cache                     OK
wp_spimDB.wp_Counterize                            OK
wp_spimDB.wp_Counterize_Keywords                   OK
wp_spimDB.wp_Counterize_Pages                      OK
wp_spimDB.wp_Counterize_Referers                   OK
wp_spimDB.wp_Counterize_UserAgents                 OK
wp_spimDB.wp_adrotate                              OK
wp_spimDB.wp_adrotate_blocks                       OK
wp_spimDB.wp_adrotate_groups                       OK
wp_spimDB.wp_adrotate_linkmeta                     OK
wp_spimDB.wp_adrotate_schedule                     OK
wp_spimDB.wp_adrotate_stats_cache                  OK
wp_spimDB.wp_adrotate_stats_tracker                OK
wp_spimDB.wp_adrotate_tracker                      OK
wp_spimDB.wp_commentmeta                           OK
wp_spimDB.wp_comments                              OK
wp_spimDB.wp_contact_form_7                        OK
wp_spimDB.wp_golfresult                            OK
wp_spimDB.wp_golftable                             OK
wp_spimDB.wp_ktaisession                           OK
wp_spimDB.wp_links                                 OK
wp_spimDB.wp_options                               OK
wp_spimDB.wp_post_views_history                    OK
wp_spimDB.wp_post_views_realtime                   OK
wp_spimDB.wp_post_views_summary                    OK
wp_spimDB.wp_postmeta                              OK
wp_spimDB.wp_posts                                 OK
wp_spimDB.wp_postview                              OK
wp_spimDB.wp_similar_posts                         OK
wp_spimDB.wp_term_relationships                    OK
wp_spimDB.wp_term_taxonomy                         OK
wp_spimDB.wp_terms                                 OK
wp_spimDB.wp_usermeta                              OK
wp_spimDB.wp_users                                 OK
wp_spimDB.wp_wassup                                OK
wp_spimDB.wp_wassup_tmp                            OK
wp_testDB.wp_Counterize                            OK
wp_testDB.wp_Counterize_Keywords                   OK
wp_testDB.wp_Counterize_Pages                      OK
wp_testDB.wp_Counterize_Referers                   OK
wp_testDB.wp_Counterize_UserAgents                 OK
wp_testDB.wp_commentmeta                           OK
wp_testDB.wp_comments                              OK
wp_testDB.wp_links                                 OK
wp_testDB.wp_options                               OK
wp_testDB.wp_pcshop                                OK
wp_testDB.wp_pod                                   OK
wp_testDB.wp_pod_fields                            OK
wp_testDB.wp_pod_helpers                           OK
wp_testDB.wp_pod_pages                             OK
wp_testDB.wp_pod_rel                               OK
wp_testDB.wp_pod_tbl_podstest                      OK
wp_testDB.wp_pod_templates                         OK
wp_testDB.wp_pod_types                             OK
wp_testDB.wp_postmeta                              OK
wp_testDB.wp_posts                                 OK
wp_testDB.wp_term_relationships                    OK
wp_testDB.wp_term_taxonomy                         OK
wp_testDB.wp_terms                                 OK
wp_testDB.wp_usermeta                              OK
wp_testDB.wp_users                                 OK
wp_testDB.wp_venues                                OK
wp_testDB.wp_wassup                                OK
wp_testDB.wp_wassup_meta                           OK
wp_testDB.wp_wassup_tmp                            OK
Running 'mysql_fix_privilege_tables'...
OK

こんな感じで管理テーブルのチェックを行ってくれる。

実行後、再度mysql -pでgrantしてみたところOKとなったので、めでたしめでたし。

コメント

  1. […] 「ユーザーの権限を編集しようとしたらできなくて、いろいろ調べて mysql_upgrade にたどり着いた。実行したら治った♪」ケース → MySQLでDB移行する時はmysql_upgradeを行おう | シーズクリエイターズブログ → mysql_upgrade | シカでした。 […]

  2. […] mysql_upgrade http://blog.pdns.jp/mysql_upgrade/ […]

タイトルとURLをコピーしました