酥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').
& m( m; `3 H7 E& v% V3 J& R9 V6 @# {9 ~- b# \7 L3 j( T
臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.
* k/ ]( k3 C7 N9 C2 c1 u* Z閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73): I2 k7 h$ h, o$ O) t; f2 q4 x9 ]
餃叮ysql 嗅頛詨 : 1 L! z3 z0 [& G1 N" n% U+ a
mysql> SHOW VARIABLES LIKE 'old_passwords';; l( Y8 f2 z3 E9 x
+------------------+-------+
# V$ V1 D6 F9 l$ T( P| Variable_name | Value |
1 W- p: E; ?+ E1 o2 H( f+------------------+-------+6 Q0 D& q1 e; U, c. j( V3 x1 j: B
| old_passwords | ON |+ k/ D6 t1 O ~; P- w
+------------------+-------+( E! x9 O [8 p: C' V. t
1 row in set (0.00 sec)
2 T* a1 G/ m* {( [5 L# g, N
) N+ M0 }' m$ s8 l- p1 H5 pold_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart, b; Q& y0 h. G+ m8 O
mysql prompt銝頛詨:
% K- I* }$ }% e! W8 |mysql> SET old_passwords=FALSE;
% u- r n" W1 B瑼X叮ysql.user 瘥撖蝣潮瑕漲:( ^& f) @. }1 `
mysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;4 {) ]7 J- x" v* ?/ ~/ Q4 q
憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣) # Z8 Y9 Z6 l% r3 [
4 g: G+ L& G2 L( g/ e0 Z8 t% T閮剖靘撖蝣:
0 C9 ?" c0 c6 H2 w* Z+ D) R- Vmysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭
! ~- T$ t+ k! {. d; Nmysql> flush privileges;" b Z5 o/ L' c" B7 _+ T. P. g. s, N
5 I B. z: @, C
頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣
3 ^1 Z4 W' e8 r* S- \' a瘜冽:7 t$ A, L& \# d: j( ^& G
憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================
6 F- F* ?1 v6 Q2 i# T鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:# w, G0 f" I! A" s, i+ t
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
0 ?# b2 |$ O9 y Imysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
/ f; D/ v/ S8 a4 S: v$ E- N# i:
2 e! a- L+ \! Z1 e( \4 ^- K3 v決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
2 o% J, C0 `$ pvi /etc/my.cnf 乩:
4 i9 }+ O! G$ w& o0 p[mysqld]) w- @% b8 A+ {1 b, K( t! ?( i) N
6 {4 f2 J* | e) w* i" p
character-set-server=utf8- H$ x5 K) _. l
default_authentication_plugin=mysql_native_password
& e$ b; G5 `! T+ A# k* A+ A; @* I& V
[mysql]' d4 O7 ^: ]; X- l; [
default-character-set=utf8
* d R5 A/ m6 f5 e5 L1 y& z
* V4 a+ B: [0 V9 S+ ~4 ~5 X[client]
) B0 a( i$ e( y/ N! k5 Mdefault-character-set=utf8" s3 ^! U/ _( ^ c) a
" y5 A' B# ?1 e' y$ R4 n4 y7 T嗅mysqld8 L- R Y+ ]( ?6 ^9 t+ w# M3 {5 Y
service mysqld restart5 N. K& K- ~$ s3 o, X B
摰!!) q$ D7 r1 Q! s. X$ ]2 `
. E6 {" }8 `4 A1 q% F
1 L, k+ C: x0 p; y, b% {) q |
|