今日の役に立たない一言 - Today’s Trifle! -

古い記事ではさまざまなテーマを書いていますが、2007年以降はプログラミング関連の話がほとんどです。

MySQLを5.6.29にしたら何か壊れた

MySQLを5.6.29にアップデートして新しいサイトを作るためにデータベースを追加しようとしたら、ユーザー権限を設定するところでエラーが出た。

mysql> create database hoge;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on  hoge.* to hoge@localhost identified by 'hogedb';
ERROR 2013 (HY000): Lost connection to MySQL server during query

ぐぐってみたら、mysql_upgrade するといいみたい。

MySQLを5.1から5.6.10に上げたらなんか壊れた話 | いちよんこーど

# mysql_upgrade -u root -p
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck with default connection arguments
Running 'mysqlcheck with default connection arguments
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.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
Running 'mysql_fix_privilege_tables'...
Running 'mysqlcheck with default connection arguments
Running 'mysqlcheck with default connection arguments
tmi.wp_commentmeta                                 OK
tmi.wp_comments                                    OK
tmi.wp_links                                       OK
tmi.wp_options                                     OK
tmi.wp_postmeta                                    OK
tmi.wp_posts                                       OK
tmi.wp_term_relationships                          OK
tmi.wp_term_taxonomy                               OK
tmi.wp_termmeta                                    OK
tmi.wp_terms                                       OK
tmi.wp_usermeta                                    OK
tmi.wp_users                                       OK
OK
# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.6.29 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> grant all privileges on hoge.* to hoge@localhost identified by 'hogedb';
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

あっさり解決。