酥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').! R' o; U2 Y$ H+ x) L
/ {, ]$ ^" U' G, K- s, q& h4 n臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.
( O2 R) K, M0 x4 d1 t閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)3 V/ z/ q& W; V* q7 j: e
餃叮ysql 嗅頛詨 : " N# y H6 L* R- ^
mysql> SHOW VARIABLES LIKE 'old_passwords';
2 g3 `9 I7 a* r3 `2 s, F+------------------+-------+
& l* i- N D, u* x, v! p| Variable_name | Value |
, B3 v8 H" L1 X0 j1 r5 c% @! s3 G+------------------+-------+
, Z) \4 k' y* Z T) W2 y) L| old_passwords | ON |
( E; r7 ^2 t+ w3 }0 N- W, ]- Z- U, f+------------------+-------+
: m- C0 q Z& x0 |2 k( R1 row in set (0.00 sec)
8 n1 ?7 k- N$ a N
# \# d1 U. k: z0 Fold_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart
* b d. [ Q. Q' E; b7 E mysql prompt銝頛詨:
" K% ^% m3 \6 I2 }) V" Y& T; ^mysql> SET old_passwords=FALSE; & Z. x A- i X: |8 ]( F
瑼X叮ysql.user 瘥撖蝣潮瑕漲:
1 O x: U1 u: }* L2 o/ X* Z& Fmysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;, i8 K: N9 |4 a4 T! F
憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣)
5 p1 _( p$ \! I5 ~) _
' D/ O% u1 N* H: d閮剖靘撖蝣:
0 ^" m A7 b5 L2 p: q, Rmysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭
* l+ I) O$ Q4 E! h/ r0 e1 Imysql> flush privileges;
( E7 N/ S0 O2 ?* G
+ w1 P5 b; r, G, y$ k( n頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣
; Z3 f7 X. L0 n8 i瘜冽:8 {+ w+ `/ Y. t0 M5 R
憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================' ]" J. }: L% c- t5 |/ n
鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:
4 V$ E" M2 A2 g4 Gmysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers! D6 p; ^ L8 {) y5 b
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
4 G W+ ^+ m; Y. {+ A3 u e' X5 d:6 I ?) m) k& ]! d0 R3 J7 P$ W1 X
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:7 G" |- u3 m9 @# j& s
vi /etc/my.cnf 乩:
, p6 _# a+ ?4 J5 j! O+ C0 j[mysqld]: P$ Y1 @2 Y- R6 k m/ R
2 n. ]2 b8 `# v! r
character-set-server=utf84 o% I4 ~, r- ~; m" X+ b0 d; B
default_authentication_plugin=mysql_native_password, t6 P# s5 m) ?& c
! k; f7 S1 W& R/ H9 p[mysql]
" {: P3 E6 s+ G4 Xdefault-character-set=utf89 g: E0 Z/ A' k* w! i! J- d `4 P
; P" X& a( z4 A7 |+ j3 a[client]
; }: E8 b, Y8 _3 `# ~) idefault-character-set=utf8
% g, y; V, i4 z' ^- y6 i
! @. x3 C* ^- j# U/ _嗅mysqld
% i& B& l, O8 ~# L. X0 i( x& ~9 C( fservice mysqld restart2 C/ X6 ]9 _: G R% a- e$ D" M8 t
摰!!7 y7 ~# g& q) }/ n; I- s
% |' i! I9 V/ ^! O8 P6 ?! s( X1 e5 _: e) d
|
|