酥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').
! V; L9 d) Z8 v$ M5 a$ E6 F3 `) D% o" z6 A
臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.
1 x0 ^7 S* {7 x w$ Y# r閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)+ u+ }" E/ n/ @. d2 X" X' m0 N$ |
餃叮ysql 嗅頛詨 : & U$ X' B) O7 D7 g1 K* x
mysql> SHOW VARIABLES LIKE 'old_passwords';: y, K" I2 J8 S+ S- d
+------------------+-------+
# Z& ~# S% [8 M$ h8 W9 ?# i: F+ I| Variable_name | Value |
( |( Q3 p0 P' N+ V& G+------------------+-------+
2 P1 C$ n7 q1 `, O| old_passwords | ON |& u* c! U9 Q8 F
+------------------+-------+7 I p& Y0 ^9 N7 q- x
1 row in set (0.00 sec)
5 `* ]% i; ? J2 a+ a. R7 h
' z- S3 u$ h `old_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart
( L9 S% C! C1 ~- J7 W0 U( s7 Z4 r mysql prompt銝頛詨:4 v9 w5 Y) p" ~' g; X
mysql> SET old_passwords=FALSE; ) _& z' Y/ V& m+ O; U" }
瑼X叮ysql.user 瘥撖蝣潮瑕漲:
* c' G& o3 t- t3 F1 B: X, pmysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;
& A% e% k# r2 z5 p6 H. C憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣)
8 k3 n3 a- i+ [6 b# k h9 \& @! [: u X4 h" Z9 W$ O
閮剖靘撖蝣:8 ~) b" Z; _7 R; L5 g. n2 L
mysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭- U5 A! l) ~- c, W' t- \
mysql> flush privileges;" W% S0 J2 [* q0 U5 ~" s) Z# s! w! y
9 W8 o( R& q4 v' f& | E+ w( V2 r頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣
: _ o, }% K/ g5 y瘜冽:, G9 h% X/ J. Z: Q" Q
憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================
" E+ y4 Q# t/ ^$ Z. B$ T鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:3 s+ s1 V g8 f3 ~ ~9 L( c+ S" Y
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
) {( R! B6 u- y) u) _8 l- Pmysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
9 o9 ]% ^: ?2 o7 W& k5 V( o3 J:7 P1 U5 z8 d( b- |8 T; O
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:. V4 o" M3 X2 D, o& u
vi /etc/my.cnf 乩:
6 _( Y" D9 A( T- V[mysqld]& W% k- y' I6 h
9 y* Z4 [( t7 Q. C# H+ }0 Gcharacter-set-server=utf88 ~1 J/ \3 Y+ M4 p6 \4 t
default_authentication_plugin=mysql_native_password4 s/ e. I7 J- j4 @$ v7 _7 N
' R7 m; s" }/ S
[mysql]" i5 `' n* j) }7 X7 j3 H7 o" ~; I
default-character-set=utf8& ~4 B: ?& Y, h, h9 N2 G4 H
P& `# M) C, t9 F
[client]
! P; R9 C* A; Z8 P: hdefault-character-set=utf8! @5 X, W$ [, v1 e
/ n/ G8 w1 o5 g+ t6 z嗅mysqld! s' y R0 {7 i" Y5 _' ^
service mysqld restart. V' g" m) A& |+ Y
摰!!
6 _1 y5 l( n4 h2 w! t6 R Z+ k; M0 N
% W4 ]0 G* `; }3 f V! T" U' S. f- ~# K+ ~
|
|