mysql:16192
From: "yoku ts." <"yoku ts." <yoku0825@xxxxxxxxxx>>
Date: Tue, 16 Dec 2014 15:46:02 +0900
Subject: [mysql 16192] Re: [mysql 16190] MySQL5.6.20をインストール後rootでログイン出来ない
こんにちは、yoku0825といいます。
rpmで突っ込むと、~/.mysql_secret にrootの初期パスワードが突っ込まれて、
SET PASSWORDで変更しないと有効にならない件…ではないように見えますので、
そこはクリアされてると思って進めますと、
my.cnfにold_passwordsが設定されている,
または rootのパスワードを設定した時に有効になっていませんでしたか?
これによりrootのパスワードが16桁ハッシュで作成されてしまったのではないかと思います。
secure-authは *サーバーと* *クライアントで*
それぞれOFFにされる(skip-secure-authまたはsecure-auth=0)必要があるので、
my.cnfの[mysqld]セクションにskip-secure-authを追加してあげれば可能だと思います。
↓バージョンちょっと違いますが、再現させてみました。
bash-4.1# cat /root/.mysql_secret
# The random password set for the root user at Tue Dec 16 01:32:45 2014
(local time): NpWp_bz1tOSHMv1y
bash-4.1# mysql -uroot -pNpWp_bz1tOSHMv1y
mysql> SET PASSWORD = PASSWORD('hoge');
Query OK, 0 rows affected, 1 warning (0.00 sec)
-- ワーニングが出ませんでしたか? --
mysql> SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message
|
+---------+------+--------------------------------------------------------------------------------------------------------------------------+
| Warning | 1287 | 'pre-4.1 password hash' is deprecated and will be
removed in a future release. Please use post-4.1 password hash instead |
+---------+------+--------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
mysql> SHOW GRANTS;
+---------------------------------------------------------------------------------------------------------------+
| Grants for root@localhost
|
+---------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD
'13ae08e92ef36dd0' WITH GRANT OPTION |
| GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
|
+---------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
mysql> SELECT @@old_passwords;
+-----------------+
| @@old_passwords |
+-----------------+
| 1 |
+-----------------+
1 row in set (0.00 sec)
-- 16桁ハッシュで保存されています --
bash-4.1# mysql -uroot -phoge
Warning: Using a password on the command line interface can be insecure.
ERROR 2049 (HY000): Connection using old (pre-4.1.1) authentication
protocol refused (client option 'secure_auth' enabled)
-- クライアントが16桁ハッシュでの認証を拒否するので、Error 2049(2000番台はクライアントのエラーコードです)が出ます --
bash-4.1# mysql -uroot -phoge --skip-secure-auth
Warning: Using a password on the command line interface can be insecure.
ERROR 1275 (HY000): Server is running in --secure-auth mode, but
'root'@'localhost'
has a password in the old format; please change the password to the new
format
-- クライアントに16桁ハッシュを許可させても、サーバーが16桁ハッシュを拒否するのでError
1275(1000番台はサーバーのエラーコード)になりました --
# vim /usr/my.cnf
..
[mysqld]
old_passwords= 1
skip-secure-auth
..
bash-4.1# /etc/init.d/mysql restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
-- サーバー側でもskip-secure-authにして再起動します --
bash-4.1# mysql -uroot -phoge
Warning: Using a password on the command line interface can be insecure.
ERROR 2049 (HY000): Connection using old (pre-4.1.1) authentication
protocol refused (client option 'secure_auth' enabled)
-- サーバー側でskip-しても、クライアント側で拒否するのでクライアントからskip-secure-authを外すと2049になります --
bash-4.1# mysql -uroot -phoge --skip-secure-auth
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.22 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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>
-- 両方のsecure-authがOFFになることで初めて16桁ハッシュで認証できました --
取り敢えず5.6.21ではこれでしのげるかも知れませんが、
5.7ではskip-secure-authは完全に解釈されなくなっているので
(5.6にもいつバックポートされるかされないかわかりませんし)
old_passwordsの設定を消して最初からセットアップするのが良いとは思います。
余談ですが、
> パスワードハッシュの管理に
> 変更が入ったこと、およびMySQL5.6から新しい管理方式が標準となったこと
> により発生している問題と理解した
パスワードハッシュが変わったのも、新しい方が標準になったのも10年以上前です :-P
解決しますように。
yoku0825,
2014年12月16日 15:07 koichi.s <asp91462@xxxxxxxxxx>:
>
> メーリングリストの皆さま
>
> はじめまして
> WEBシステム構築をメインとしている技術者の佐々木浩一と申します。
> いつもはJAVA+Oracleを使用しての開発が多いMySQL初心者です。
>
> MySQLは初めてですが、Oracle以外にPostgreSQLなどは環境構築の経験ありです。
>
> 今回、依頼元の要望によりシステムの一部をRHEL+MySQL+Perl(CGI)にて
> 構築する事になり、環境構築を行っているのですが、表題のとおりrootにて
> ログイン出来ない状況に陥ってしまいました。過去ログなどを拝見したのですが
> ピンと来る情報にたどり着けませんでしたので、ご存知の方がいらっしゃれば
> 勝手なお願いで恐縮ですが、ご教示頂けませんでしょうか?
>
> 【状況】
> ・依頼元指定のOS(RHEL6.2)のカスタムインストール版OS(MySQLはmysql-libs
> 5.1.52-1.el6_0.1のみインストール済)のマシンにMySQL5.6.20-1.el6を
> バンドル版アーカイブファイルからyumでインストール
> ・MySQLのsharedインストール時、mysql-libs 5.1.52-1.el6_0.1が競合したため、
> 代わりにMySQL-shared-compat-5.6.20-1.el6にてmysql-libsのアップデート
> ・インストールしたパッケージは以下(全て5.6.20-1.el6)
> MySQL-client
> MySQL-devel
> MySQL-server
> MySQL-shared-compat
> MySQL-test
> ・インストール完了後にOSのrootでMySQLを起動し、起動後に以下のコマンドを実行
> msql -uroot -p
> すると、以下のメッセージが表示された
> Connection using old(pre-4.1.1)authentication protocol refused(client
> option 'secure_auth' enavled)
> ・過去ログや他の方のblogなどを拝見した結果、パスワードハッシュの管理に
> 変更が入ったこと、およびMySQL5.6から新しい管理方式が標準となったこと
> により発生している問題と理解した
> ・msql -uroot -pのコマンドに追加パラメータとして--skip-secure-authを追加
> その結果、ログインに成功(rootにパスワードを設定してログアウト)
> ・mysql起動状態でメモリ使用状況を確認したところ、2Gbyte以上を使用していたため、
> my.cnfに初期メモリなどの設定値を設定しmysqlを再起動
> ・再度rootでログインしようとしたところ、以下のエラーが発生し再度ログイン出来ず
> Server is running in --secure-auth mode, but 'root@localhost' has a
> password in the old format; please change the password to the new format
> それ以降、何をやっても上記エラーでログイン出来ず
>
> といった状況です。
> 過去ログや色々な方の記事を拝見すると、そもそも5.1から5.6への更新は推奨されていない
> などの断片的な情報は見つかるものの、見つけ出した断片的な情報を試しても解決出来ませんでした。
>
> rootでログイン出来ないとどうする事も出来ず、困っております。
>
> よろしくお願いいたします。
>
>
>
16190 2014-12-16 15:07 ["koichi.s" <asp91462] MySQL5.6.20をインストール後rootでログイン出来ない -> @ 16192 2014-12-16 15:46 ┗["yoku ts." <yoku0825] Re: [mysql 16190] MySQL5.6.20をインストール後rootでログイン出来ない 16193 2014-12-17 11:38 ┗["koichi.s" <asp91462] Re: [mysql 16192] Re: [mysql 16190] MySQL5.6.20をインストール後rootでログイン出来ない @ 16194 2014-12-17 12:46 ┗["yoku ts." <yoku0825] Re: [mysql 16193] Re: [mysql 16192] Re: [mysql 16190] MySQL5.6.20をインストール後rootでログイン出来ない