酥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').3 i! P# J; ^% ?5 o; d' Y- t% }
5 r4 p5 |1 \2 O/ G
臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.
! i' e) q6 k! u- t& q: F& k+ a$ T( C閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)* W2 s- \# f" ]* o: ]
餃叮ysql 嗅頛詨 : ! |) C% F% J& m; n, F* m% v
mysql> SHOW VARIABLES LIKE 'old_passwords';
5 s7 ^, G$ q" R. K; n* w+------------------+-------+
/ H7 K* Q) `/ _, c; ^| Variable_name | Value |
8 H- F8 d6 C% H' ^! ^# y+------------------+-------+7 s8 A% [% R/ E8 K1 a; ~/ g
| old_passwords | ON |/ W2 E# p; P* E& e1 O2 F! m$ }
+------------------+-------+
4 K' n0 h8 l) R. ?/ A% g1 row in set (0.00 sec)
7 h+ `$ U% F: ?8 f# [6 \' E
) e: A# m3 I- @/ ~, C9 m6 Vold_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart
0 z* y; M5 ~/ B( r! F& } mysql prompt銝頛詨:' H8 u3 J1 o0 f; W9 T
mysql> SET old_passwords=FALSE;
2 D" Q' R% k3 A& y瑼X叮ysql.user 瘥撖蝣潮瑕漲:
3 ~& z) J$ R2 U! e: D( t, fmysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;$ \1 d5 _/ _; N8 k6 ^
憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣) f# U8 d9 @1 f1 A0 A7 F
5 N) L- i' K( u3 @! G. l
閮剖靘撖蝣:
1 s1 j, D# m( Q0 Y0 x: J" l* cmysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭
- H0 v' V9 p) m' ?9 C+ Rmysql> flush privileges;- {* g: d, t- E1 g
( P3 _! S M: D) k
頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣
' G; D7 N6 h6 T$ Z1 k6 n瘜冽:* a }$ h3 ?( M/ O
憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================2 V/ H2 U8 _; X+ o+ }% m# j- I
鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:' B1 {9 G5 `. V- i2 ^; X$ ~- i( K
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
C7 u/ s8 O, Y" N7 z: `6 ~mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
% m7 ^3 |* [& Q5 i* b9 z( d:
" F6 C9 ?; E& o) n* F: n決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:8 S; P/ j- |& b6 p8 d" r
vi /etc/my.cnf 乩:
- |$ O# Q1 W" f8 u; N[mysqld]
) Q5 n4 t* W: C7 M
/ u1 }3 c1 f( T' v9 Ucharacter-set-server=utf8) i* P9 `: J% J1 Y! t
default_authentication_plugin=mysql_native_password
5 Q$ p3 E0 V5 D( K& |1 b" E+ p6 M% l
. A" }' e+ B7 f8 h[mysql]; }1 z! x& \1 v7 b& R
default-character-set=utf8, _& y0 q8 v1 |# U) k6 M% x
- n* Y" L+ D1 U2 x1 K
[client]
4 S+ G( p) H" V0 Q5 }5 sdefault-character-set=utf8 D% d1 G! {* x. c% I! Q
3 V7 t+ r/ {: b% r嗅mysqld
+ B a) r0 @" n* O. vservice mysqld restart: q9 c5 f) c; n* e/ c
摰!!
4 X. H& L& n7 j) H2 v% ?: |) k' q" V) {. `4 V- s' i6 ~' p
) _# s0 W& u, E
|
|