Quantcast
Channel: Planet MySQL
Viewing all articles
Browse latest Browse all 1081

MySQL 5.7.6ではSET PASSWORD = PASSWORD(..) するとSyntax Errorと言われる

$
0
0
MySQL::Sandboxを使ってレプリケーションをセットアップしようと思ったらふと気付いた。


[mysql@v157-7-154-209 ~]$ make_replication_sandbox 5.7.6 --how_many_slaves=2
installing and starting master
ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'password('msandbox')' at line 1
mysqldump: Got error: 1045: Access denied for user 'msandbox'@'localhost' (using password: YES) when trying to connect
can't load grants
error installing the master

(512 )

Syntax Error…?
手で打ってみた。


mysql> SET PASSWORD= PASSWORD('root_password');
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'PASSWORD('root_password')' at line 1

( ゚д゚) ファッ!?


なんか変だと思ってmysql.userテーブルを探してみたら、passwordカラムがなくなっていたことに気付いたがそれは別のエントリーに置いておいて、
日々の覚書: プレビュー "MySQL 5.7.6でmysql.userテーブルのパスワードのカラム名がなんか変わった"
SET PASSWORDステートメントはPASSWORD関数を通さなくても勝手にハッシュするようになったぽい。
(なので、変にPASSWORD関数の戻り値を渡してしまうと、ハッシュ後の値が元のパスワード値と認識されちゃうから敢えてエラーになっている…?)

mysql> SET PASSWORD= 'root_password';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT user, host, authentication_string FROM mysql.user;
+------+-----------+-------------------------------------------+
| user | host | authentication_string |
+------+-----------+-------------------------------------------+
| root | localhost | *2AF14BD74D8A4FDB580D3208C0092BE75EE95B75 |
+------+-----------+-------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT PASSWORD('root_password');
+-------------------------------------------+
| PASSWORD('root_password') |
+-------------------------------------------+
| *2AF14BD74D8A4FDB580D3208C0092BE75EE95B75 |
+-------------------------------------------+
1 row in set (0.00 sec)

ちゃんと合ってる。
敢えてエラーにするのはいいことだと思うけど、Syntax Errorは違うだろう。。

ちなみに5.7.5以前のバージョンでやると、5.6までの挙動と同じで


mysql57> SET PASSWORD = 'root_password';
ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number

こうなる。


うわー、非互換かぁ。。これいろいろつらい気がする(自動セットアップ系の何かで)

MySQL :: MySQL 5.7 Release Notes :: Changes in MySQL 5.7.6 (2015-03-09, Milestone 16) に Incompatible Changeとして載っているので、バグではないぽい(ばぐれぽ上がってたけど)


PlanetMySQL Voting: Vote UP / Vote DOWN

Viewing all articles
Browse latest Browse all 1081

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>