酥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').
! |4 @2 F- k' U; A/ ^& ]" G5 l1 g( m+ Q; C! v, b
臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.( i" j5 u' B/ I) `% m
閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)5 I2 c2 |) j+ D: s1 Y
餃叮ysql 嗅頛詨 :
- b9 d* u, Z# T0 o0 [$ @mysql> SHOW VARIABLES LIKE 'old_passwords';
& _! Q' x' {" F \4 N0 H+------------------+-------+; R4 r0 n4 Z1 x" B7 H: Y
| Variable_name | Value |- v& g# w! r. Q% k, N+ n
+------------------+-------+
7 B% P+ G8 g5 w| old_passwords | ON |! H! L2 ]! C0 [: G( e, V$ [
+------------------+-------+ ^9 s% J' b3 |/ C2 x! E
1 row in set (0.00 sec)$ ~4 b0 R* D& T3 _, i$ z
7 _, w; e$ _) G3 X3 {) T) S3 X. Hold_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart) e/ r3 k3 |/ @! S# |1 r( R- B
mysql prompt銝頛詨:
; B0 f% c* g7 O. `! j: D, Gmysql> SET old_passwords=FALSE; 4 X- P, ^0 a4 Q9 {% T6 J o8 P" p2 f
瑼X叮ysql.user 瘥撖蝣潮瑕漲:
! T2 T2 x9 X: bmysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;
m. y; X4 F% p憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣)
) S) M: H7 L8 P9 I4 ]0 o1 m
/ H: y* V& r$ o5 L: ^; R0 A' l閮剖靘撖蝣:
0 H, e) u+ ? ^2 `; m% l) \mysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭, G7 U# C E8 c! G$ s% O+ ?& I) P
mysql> flush privileges;* p# s4 Q q9 J$ R% K
7 r4 c/ C( f% u" y: J頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣
/ m' u$ @' s/ ^& ~3 E瘜冽:6 n8 }. |1 p0 f/ B, }8 G
憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================
$ g8 K; F5 Y4 y+ k3 S鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:
1 x/ q4 ~9 Z' q/ ]& L# R2 {mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
r! C+ [# I9 h( ~4 S0 ?, O3 fmysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers$ U3 j A' Z1 P# i3 y
:' p. E, q4 Q. g! {
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:* N' \4 f1 K" Y1 s
vi /etc/my.cnf 乩:0 j% H9 D" r+ p& W; m4 b/ j& V* B
[mysqld]$ p; h6 c8 T0 \. l7 r2 O
- V A% a' X7 e, n7 e! f1 }character-set-server=utf8( Q! v/ j8 p7 t
default_authentication_plugin=mysql_native_password" V. h+ R9 z( P: `
& x' r9 n8 s: |2 x
[mysql]
1 x# e [2 N2 xdefault-character-set=utf8( D j: U j a* K: U
7 Z! K7 u6 c$ L, B: L7 z
[client]
% p7 _; Z6 n2 @' L9 Z* ldefault-character-set=utf8
# j1 \# S+ K# w+ _# N2 k6 e/ t
3 M; n2 Q7 @& K: S# Z嗅mysqld
0 i/ w+ X* h4 }) Zservice mysqld restart. ]; M9 `# f* A( Y6 S$ q1 A* }
摰!!7 H( j- o6 X, _0 {6 u1 @
?# ^/ i# t) C P( I" y- R, L$ y; U0 K8 t2 K
|
|