ハマログ

株式会社イーツー・インフォの社員ブログ

MySQLでgrantしたら失敗したので解決しました

MySQLのユーザをつくって、grantしたら失敗しました。
rootで。

create user e2info identified by 'password';

grant all privileges on *.* to dance@'%' identified by 'password';
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

rootのGrant権限確認

mysql> select user,Grant_priv from mysql.user where user = 'root';
+-------+------------+
| user  | Grant_priv |
+-------+------------+
| root  | Y          |
| root  | Y          |
+-------+------------+

こっちも確認

mysql>  show grants;
| 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 '*ABABABABABABABABABABABABABABABABABABABABA'
 WITH GRANT OPTION |

ログが出ていなかったので出力設定

vim /etc/my.cnf

[mysqld]
# (略)
log-error=/var/log/mysqlerror.log
log-warnings=1

コマンド再実行して、みてみる

tail -50f /var/log/mysqlerror.log

141031 16:14:12 [ERROR] Missing system table mysql.proxies_priv;
please run mysql_upgrade to create it

おー。

言われたとおりに実行

mysql_upgrade
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
FATAL ERROR: Upgrade failed

がーん。

こうでした

mysql_upgrade -u root -p
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck' with connection arguments: '--port=3306'
Running 'mysqlcheck' with connection arguments: '--port=3306'
database.table                                   OK
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'...
OK

どうやらyumでバージョンアップした時に壊れたようです。

mysql -u root -p
Enter password:
mysql> grant all privileges on *.* to e2info@'%' identified by 'password';
Query OK, 0 rows affected (0.00 sec)

成功!

めでたしめでたし。

failedGrantmysqlmysqlcheckmysql_upgraderole失敗権限

  kaneko tomo   2014年10月31日


関連記事

Laravel4でForm::checkboxのチェック状態判定

laravel4にてForm::checkboxのチェック状態判定を行いました。…

Laravelのメール文字化け対策

Laravelのメール送信で文字化けと対決したのでその記録。 Swift Mai…

WordPressサイトにユニバーサルアナリティクス設定

こんにちは、かねこです。 Googleユニバーサルアナリティクスが正式公開された…


← 前の投稿

次の投稿 →