mysql:16138
From: "yoku ts." <"yoku ts." <yoku0825@xxxxxxxxxx>>
Date: Wed, 9 Jul 2014 18:40:26 +0900
Subject: [mysql 16138] Re: [mysql 16137] root@localhostのグローバル特権の復旧
こんにちは、yoku0825といいます。
--skip-grant-tables で起動した状態で、mysql.userテーブルにINSERTをかけます。
mysql> SHOW CREATE TABLE mysql.user\G
*************************** 1. row ***************************
       Table: user
Create Table: CREATE TABLE `user` (
  `Host` char(60) collate utf8_bin NOT NULL default '',
  `User` char(16) collate utf8_bin NOT NULL default '',
  `Password` char(41) character set latin1 collate latin1_bin NOT NULL
default '',
  `Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
..
  `max_connections` int(11) unsigned NOT NULL default '0',
  `max_user_connections` int(11) unsigned NOT NULL default '0',
  PRIMARY KEY  (`Host`,`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and
global privileges'
1 row in set (0.01 sec)
* カラム名を調べます。
mysql> INSERT INTO mysql.user SET
    -> Host= 'localhost',
    -> User= 'yoku0825',
    -> Password= PASSWORD('s3cret'),
    -> Select_priv= 'Y',
    -> Insert_priv= 'Y',
..
    -> ssl_type= '',
    -> ssl_cipher= '',
    -> x509_issuer= '',
    -> x509_subject= '',
    -> max_questions= 0,
    -> max_updates= 0,
    -> max_user_connections= 0
    -> ;
Query OK, 1 row affected (0.00 sec)
* INSERT INTO .. SET構文を使っていますが、VALUESでも構いません。
* なんちゃら_privのカラムを全て'Y'のユーザーを作ります。
* passwordはPASSWORD関数を通す必要があります。
この後、--skip-grant-tablesを外して再起動すると、追加したユーザーが使えるようになります。
(↑の例であればyoku0825@localhostでパスワードがs3cret)
yoku0825,
2014年7月9日 17:53 Kenji Kawachi <k.kawachi@xxxxxxxxxx>:
> 河内と申します。
>
> phpmyadminでrootのグローバル特権をすべて外して実行をしてしまいました。
> 回復の方法をご存じの方、ご教授ください。
>
> my.cnf に
> --skip-grant-tables
> を追加し、再起動。
>
> クエリで以下を実行したのですが、
> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
>
> 以下のエラーがでてしまいます。
> ERROR 1290 (HY000): The MySQL server is running with the
> --skip-grant-tables option so it cannot execute this statement
>
> バージョンはmysql5.0.45です。
>
> よろしくお願いいたします。
>
>
>
>
16083 2014-01-23 16:20 [tutui <tutui@xxxxxxx] 第2回 MariaDB/MySQL のコミュニティイベント 16090 2014-02-17 11:54 ┗[tutui <tutui@xxxxxxx] 16091 2014-02-17 12:23 ┣[遠藤 俊裕 <endo@xxxx] 16092 2014-02-19 19:26 ┃┗[tutui <tutui@xxxxxxx] 16137 2014-07-09 17:53 ┗["Kenji Kawachi" <k.k] root@localhostのグローバル特権の復旧 -> @ 16138 2014-07-09 18:40 ┗["yoku ts." <yoku0825] Re: [mysql 16137] root@localhostのグローバル特権の復旧 @ 16139 2014-07-10 10:17 ┗["Kenji Kawachi" <k.k] Re: [mysql 16138] Re: [mysql 16137] root@localhostのグローバル特権の復旧