酥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').
9 |! u$ [4 ?7 X
1 s. _$ E: j* }' ?5 f* |( f" S1 @. p臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.
4 I+ ]' V. X$ p4 l( f; g7 ?: _9 h閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73): Z- f) y9 T, }/ F! y+ D
餃叮ysql 嗅頛詨 :
e' `8 n$ t/ Omysql> SHOW VARIABLES LIKE 'old_passwords';
9 \3 X% F# p- n: }( n# N9 B7 U2 A+------------------+-------+
# Y# U ^! V& m9 G/ A' b) r2 ]1 w| Variable_name | Value |
. _1 s, U$ r4 G' R# V0 C+------------------+-------+. K# ^( R5 b6 p
| old_passwords | ON |+ D% S# W6 E$ }) r
+------------------+-------+
! M' F& K8 m4 V" Z% ]4 u, q/ O9 o1 row in set (0.00 sec)1 F' t1 y: {: i9 ~& H# V; S3 W" `
1 x1 x9 d' N* x3 [. o7 z, sold_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart) @$ W% {5 L4 s5 b- s) t
mysql prompt銝頛詨:
$ @7 p0 Z/ i5 @0 j1 K' j% Hmysql> SET old_passwords=FALSE; / v( m$ `$ U3 `! q8 S9 T) G8 n, y
瑼X叮ysql.user 瘥撖蝣潮瑕漲:2 P/ }+ Z4 S& Z! e
mysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;" g& k% P7 V7 w$ V0 H$ J5 G4 v u3 \
憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣) 4 q( M0 o w, [$ ?1 f) `& ~
) r7 H1 m. X/ h
閮剖靘撖蝣:3 M6 _) }, ?* `0 A9 Q
mysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭
8 k" f4 O9 [) F. O7 ]7 vmysql> flush privileges;0 Z" }. d2 |% f' Z
! A+ o2 ]) T$ O6 N, A: z頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣
; H4 r- B! s& W& f5 B瘜冽:
3 O, F2 e8 ^( g. s2 v% I/ R憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================- Q h* P* [, O
鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:$ v% ?. V# f& k a4 t( \- S
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers1 s$ j( p/ E+ _/ x6 T
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers+ L2 D+ t$ l/ r. e6 p% c* f3 _
:/ ]( N) w) o- i- E* W* M; Y% h
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
! C" Z7 w) t5 H) t5 d8 ovi /etc/my.cnf 乩:* B0 q: R) ^) R8 p
[mysqld]
' X9 v5 X8 x) o; ^: \9 X f# D# F; N% A; z$ \% X3 X6 s2 t
character-set-server=utf8
) W; o$ \+ Q# l3 Fdefault_authentication_plugin=mysql_native_password
$ |7 h1 z( R; B3 k3 k( E
1 Q7 V/ `( x% w3 n3 G[mysql]0 G. {" b; d. i: J" Y9 R v
default-character-set=utf8
. S, g4 N) W* c7 N" Y
* c8 F" f% u: W9 o* q: X[client]: i% R9 D$ T) C% w/ T+ S
default-character-set=utf8
0 K( |& c' \% l3 o: D' @" I* q' Z5 }4 I/ F0 e. `, x
嗅mysqld
3 X2 ^. r, i M0 j& e$ Tservice mysqld restart
) s) \* k& L( X4 p* L; l& Q8 ~6 z摰!!8 f# ?1 i6 W: [# ]* C6 {
: M* o: N8 l& Q& B; T0 J, f6 A* ^; }+ C) d" G( \" C; v
|
|