MySQL
homebrew

homeberwでMySQL5.6にupgradeしたらユーザーが作成できなくて困ったときのメモ

More than 5 years have passed since last update.

mysql5.6にアップしてしばらくですが、ユーザーの追加を行おうと思ったら

mysql > GRANT ALL PRIVILEGES ON *.* TO 'shikataka'@'localhost' IDENTIFIED BY 'hogehoge' WITH GRANT OPTION;

ERROR 2013 (HY000): Lost connection to MySQL server during query

なんて言われてユーザーが作成できませんでした。

一般には外部アクセスに失敗している時のエラーのようですがローカルへの接続なのでアクセスに失敗するというのもおかしい。

とりあえず


my.cnf

max_allowed_packet = 32M


こんな設定をしてみましたが変わらず…

エラーログ見るとこんなログが


error.log


2013-03-21 16:41:35 63836 [ERROR] Native table 'performance_schema'.'users' has the wrong structure
2013-03-21 16:41:35 63836 [ERROR] Native table 'performance_schema'.'accounts' has the wrong structure
2013-03-21 16:41:35 63836 [ERROR] Native table 'performance_schema'.'hosts' has the wrong structure
2013-03-21 16:41:35 63836 [ERROR] Native table 'performance_schema'.'socket_instances' has the wrong structure
2013-03-21 16:41:35 63836 [ERROR] Native table 'performance_schema'.'socket_summary_by_instance' has the wrong structure
2013-03-21 16:41:35 63836 [ERROR] Native table 'performance_schema'.'socket_summary_by_event_name' has the wrong structure
2013-03-21 16:41:35 63836 [ERROR] Native table 'performance_schema'.'session_connect_attrs' has the wrong structure
2013-03-21 16:41:35 63836 [ERROR] Native table 'performance_schema'.'session_account_connect_attrs' has the wrong structure


なんか壊れてるっぽい。

ググってみたら


I've run mysql_upgrade and after that problem has >gone.


http://stackoverflow.com/questions/6288103/native-table-performance-schema-has-the-wrong-structure

なんてあったのでmysql_upgradeを実行。

> mysql_upgrade -u root -p

Warning: Using a password on the command line interface can be insecure.
ERROR 1436 (HY000) at line 1904: Thread stack overrun: 11520 bytes used of a 131072 byte stack, and 128000 bytes needed. Use 'mysqld --thread_stack=#' to specify a bigger stack.
FATAL ERROR: Upgrade failed

エラーが出たのでmy.cnfを設定


my.cnf

thread_stack = 256K


再度実行

> mysql_upgrade -u root -p

OK

無事終わったのでユーザーを作成してみる。

mysql > GRANT ALL PRIVILEGES ON *.* TO 'shikataka'@'localhost' IDENTIFIED BY 'hogehoge' WITH GRANT OPTION;

Query OK, 0 rows affected (0.00 sec)

成功しました。