酥hp 5.5隞乩 銝 mysql 5.2 嚗叮ysql隞 mysqli_connect() Y航炊mysqli_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password').
D, D0 m% Z: Q5 V6 B) a, J6 `; n
臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.
4 I) [% F7 N. Z1 d2 F1 q% Q閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)1 Q$ d" F. Y/ i9 R% E
餃叮ysql 嗅頛詨 : ' V3 @4 A5 X6 b9 U: X) h, H6 J
mysql> SHOW VARIABLES LIKE 'old_passwords';4 _' w3 e+ e B# V% C
+------------------+-------+" t, F. ?) z/ [7 E$ o9 {: F
| Variable_name | Value | z7 i1 ?& b9 d* ~/ k6 ]9 h. I2 C
+------------------+-------+0 c& l# T- W1 h
| old_passwords | ON |
/ u6 `; t1 g7 `/ i i+------------------+-------+
# B1 V# N) q. H) T- p. p9 X& [! |1 row in set (0.00 sec), X; P5 ]. r% h) \$ @8 ]
0 f6 x/ c* j Y
old_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart+ _& e( a* {+ K& |4 i
mysql prompt銝頛詨:$ N3 W4 f* f% z- O2 j }
mysql> SET old_passwords=FALSE;
' \& Z4 s& ~0 J3 ^瑼X叮ysql.user 瘥撖蝣潮瑕漲:& s$ f' E# Q6 Z I7 Q+ W
mysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;
: R, S9 Y' \, X3 p- v: w @憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣) 5 R l7 ^# n0 ^" l0 f
6 a) j J) T7 L& ` I4 c
閮剖靘撖蝣:
j; X8 [( ^6 @* G' v) a+ Y! u9 Nmysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭
3 E2 z, V4 i" G. umysql> flush privileges;
5 Z; o X7 B- g! D9 m' U6 w4 f3 K
* T* W) ? q2 @' S$ e8 t頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣
% [: @; g' h' h5 c3 o; }瘜冽:# M. x2 @1 k* G2 a
憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================
2 G5 V: E9 x1 r! |' M* ]鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:
, d7 Y3 W$ m4 R% f" [ wmysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
+ R: R7 ]4 M$ V7 c3 H- ?mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
# s* F( W3 I2 f- x! d: @. t Y:
( ?8 D( U: W2 e# w& Y- @7 r決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:/ g: g% n0 q0 U8 x* _
vi /etc/my.cnf 乩:
/ g! H! s. ^ V+ i[mysqld]
& C) Q' J) k. S" m) T/ E% H4 m, j/ A w+ S
character-set-server=utf8+ K7 e% \9 H, M# w* P6 v; O
default_authentication_plugin=mysql_native_password
% M1 ^& l/ ~' f) g7 s4 G3 H3 F2 }+ b$ n9 z' X. @, K$ }: y, v
[mysql]1 s( K8 ], z: B7 c" k, g% a
default-character-set=utf8& T: j8 z/ K& \$ X$ a7 a
, u9 B) }+ K: l0 i[client]/ ?3 F& D4 n# W
default-character-set=utf89 v# q+ y; k% t5 _
3 }$ W ~9 P7 Z# B" I6 u" `
嗅mysqld
7 q4 b ?/ k1 h2 u5 z( a% jservice mysqld restart
* h, c& S) D/ N# k1 y L摰!!
6 R5 x. n& [6 u7 H: y% ]
0 w9 \# V" [- ]# B
0 Z2 X9 x. ^: L5 P$ Q |
|