酥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 R9 N9 M z; H" Q& i. F7 P4 Z+ `( \+ W7 ?" T- a% x& X1 J3 b
臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.4 v$ r7 n8 ^4 ^0 n3 g6 c5 k: D& u7 D
閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)7 L7 y" l# v& f& i
餃叮ysql 嗅頛詨 : % K1 O: f/ w1 R- @$ K. m+ f3 A
mysql> SHOW VARIABLES LIKE 'old_passwords';
: l" y, n# L1 S5 R# K+------------------+-------+7 i1 q$ G: G$ A
| Variable_name | Value |
4 U/ d+ O7 v4 y; S. T9 E1 u+------------------+-------+* p9 v; S1 U+ {
| old_passwords | ON |8 A, [* D# p' ?$ T1 y4 g, e, \ A
+------------------+-------+; G' }! N. y5 D3 m% u) z; n4 G$ \+ `
1 row in set (0.00 sec)8 I% A, d% N# {1 a
( J7 k8 y6 o$ `4 Rold_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart
. r7 Y( H) ~' g( \ mysql prompt銝頛詨:! y7 C1 P8 `5 T
mysql> SET old_passwords=FALSE;
" o1 c+ U4 _0 J+ ~: U, h) m" M瑼X叮ysql.user 瘥撖蝣潮瑕漲:
: U/ v. i3 e+ N/ U/ {# N* Gmysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;+ q3 w ]; H4 e6 k
憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣)
" L6 s# x( h) j. k* n$ o: J' v
# K5 r* b8 I+ `閮剖靘撖蝣:7 c9 V4 Z# m" x" G
mysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭3 p# z6 r0 W- G V1 N
mysql> flush privileges;
6 m4 N1 m. a% M! F8 u. u$ p1 G4 A4 t* A4 T4 i+ s. }
頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣: e% T5 a& m' N {* ]+ P+ e
瘜冽:6 N _$ J4 D4 U+ A
憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================
! w# D" s3 \+ Q! n' G. d( ^- f鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:0 @, N( J2 [6 u6 H/ Q8 _7 ?
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
. T: w! s; B7 ^0 P# Jmysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers' L( z% {% n/ X% J( o z9 t
:
* _4 h) Z3 P f/ p決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
% Q3 e8 S9 t' F# w6 vvi /etc/my.cnf 乩:
6 R" p. o' {/ u! x/ n# r[mysqld]
- Z9 b) `. ` S/ B/ Z6 V5 {$ g/ F5 i% w% u B: T5 v* }$ ^
character-set-server=utf8& P2 }! `2 n. G
default_authentication_plugin=mysql_native_password
9 n' A3 l- a$ n8 u# Y
, \) @( P6 w9 y8 t: z! C m[mysql]2 F7 G7 E2 {/ {% z2 ]& s; P
default-character-set=utf8; _" ]# T3 c% R6 [/ h5 q, D
+ d( h0 a& K8 C+ e9 ?& Y[client]* Y$ l( Z6 F8 Y; I1 {0 G- D
default-character-set=utf82 |7 N3 e/ N/ g; w
! u5 H6 M9 r+ d5 O嗅mysqld! L# b! \9 m0 X- [1 \
service mysqld restart+ K6 F! i* }/ Y! [- ~0 ]6 h$ Q
摰!!
V h7 Q- N2 y" P2 v Y1 H; c/ u- X8 ^0 H, X
( X2 A& C" f" F! H9 ` |
|