--> -->

skimemo


skimemo - 日記/2018-09-06/MySQLのmysqld_upgradeで苦労した話 のバックアップソース(No.1)

#blog2navi()
*MySQLのmysqld_upgradeで苦労した話 [#m3e94362]

~今までMAMPでローカルに環境を作っていたのですが、遅いので自前でWAMP環境を作ることにしました。
~その際、MySQLは最新のバージョンをインストール。データディレクトリはそのまま利用したところ、以下のエラーが出るようになりました。
 Table 'performance_schema.session_variables' doesn't exist
~通常の使用ではあまり問題無いのですが、MySQL Workbenchが使用できないので調査したのですが、意外に情報が無くはまったのでメモ。
~
このへん(([[Table 'performance_schema.session_variables' doesn't exist エラー:https://qiita.com/munaita_/items/6543834ecb6f0c84ff23]]))にもあるように、このエラーはMySQLのバージョンが新しいにも関わらず古いDBを使用している時に発生します。従って、mysql_upgradeをすれば良いとあります。~
そこで mysql_upgrade を実行してみます。
 >bin\mysql_upgrade.exe
 mysql_upgrade: Got error: 2003: Can't connect to MySQL server on 'localhost' (10061) while connecting to the MySQL server
 Upgrade process encountered error and will not continue.
なにやらエラーになるご様子。~
ググると、-u rootで接続されていないのではないか、との記述がありました(([[`mysql_upgrade` is failing with no real reason given:https://serverfault.com/questions/527422/mysql-upgrade-is-failing-with-no-real-reason-given]]))。~
そこで早速rootで入ろうとするものの、パスワード無しなはずなのにエラーになります。
 >bin\mysql_upgrade.exe -u root -p
 Enter password: 
 mysql_upgrade: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) while connecting to the MySQL server
 Upgrade process encountered error and will not continue.
仕方が無いので、認証スキップで実行(([[MySQLのrootパスワードを忘れた!ってときの対処法(Windows):https://qiita.com/Nekonecode/items/c44896105f1c2b22630e]]))。
 >bin\mysqld --skip-grant-tables
別のDOS窓を立ち上げて、
 >bin\mysql_upgrade -u root
めでたく解決しました。

#htmlinsert(twitterbutton.html)
RIGHT:Category: [[[Windows>日記/Category/Windows]]] - 18:26:27
----
RIGHT:&blog2trackback();
#comment(above)
#blog2navi()