酥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').
+ S) j R7 g5 ?
% d3 H. K. {* B; Q0 r臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.8 b) h6 m. n9 Q [/ k" x. z
閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)
" X% |2 s/ x! M2 ]0 i餃叮ysql 嗅頛詨 :
3 s7 W5 c) {, t9 fmysql> SHOW VARIABLES LIKE 'old_passwords';
% O: r; Q! B, G! ?' N. N- a& Z, o: x+------------------+-------+. r* A# `( O0 S
| Variable_name | Value |3 ~9 \$ _1 I* \6 T/ J
+------------------+-------+
! A# j8 o5 R, I1 A. H& v U B1 H| old_passwords | ON |
1 a& s: x: B h6 Q+------------------+-------+& D) S9 j' {5 A; Z5 c" x
1 row in set (0.00 sec)
% J' F+ H: r- c( M) J8 G
9 F1 B: {( Q% A5 v6 m$ g- b2 Aold_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart
4 M: V9 F2 ?5 I0 J9 U2 A j0 C mysql prompt銝頛詨:# W% q6 p3 g4 B0 U) r0 E/ |( Z. C
mysql> SET old_passwords=FALSE;
$ n5 `% F: C" M5 E7 O瑼X叮ysql.user 瘥撖蝣潮瑕漲:
. I: H# G6 B. vmysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;
/ }* w- ^5 s, r9 @" K( j1 R憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣)
5 _" ~# Z3 H. l5 d6 S M8 T+ V# B$ e/ d6 d
閮剖靘撖蝣:
+ d* G! d4 X, T/ J; Cmysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭) M! F; v2 O3 I/ o0 i0 W1 E
mysql> flush privileges;8 B0 w" i% |/ Y6 j, \
4 O& l$ ]$ {% K" t6 a* ]
頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣; q$ X1 s$ r: \; P
瘜冽:3 s% x8 ?/ s4 w" j
憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================6 I! v5 R( \+ ^
鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:" G9 t" U0 n L
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers, {2 g4 [ X" O# t% v& G C4 v
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
6 M* W1 |0 J; @3 F" U, Q:
3 v" M3 m* M: Z: c( b決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:' s7 v" V& @/ Z9 [0 ?$ W
vi /etc/my.cnf 乩:/ B2 n9 ~: {3 l) ~% F; q o; l
[mysqld]
# S- G7 t( ^; D" S: m/ V
8 V0 E9 t6 M5 f+ [. G# G. m2 ccharacter-set-server=utf8; _7 h1 M1 E6 o% q
default_authentication_plugin=mysql_native_password
- F2 l% s- K ]! Z v% V! F8 X+ N% @4 w3 C7 F1 x4 M* @
[mysql]
" [0 u2 }4 _' fdefault-character-set=utf8! Q! B. m; _# Q4 S( A5 O
* j# P) B( L: W! U[client]+ b% s, a3 F! |& c \7 i" T5 m( `
default-character-set=utf81 I' O( j. |5 t F
8 j6 u+ }. e$ q1 V- w I
嗅mysqld% _4 T$ e8 a9 d! r D) @
service mysqld restart
1 t! X* L- Q, a% x4 t* a摰!!* J2 q S0 X4 C& r$ `$ w
6 z, ]2 P0 M a. J% g
8 y4 P& Y8 _# R9 D9 [ |
|