酥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').
. P$ g7 r. I! L8 ]8 T- i( c0 }7 A# s' ] h- T6 E$ [; R7 w- {
臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.
" A! Z5 V; R3 Y, ~% ~* l閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)
0 Y/ P1 v3 C; [8 l6 a' j7 p3 [餃叮ysql 嗅頛詨 :
/ j) q3 u8 M. U8 T3 zmysql> SHOW VARIABLES LIKE 'old_passwords';/ F/ F& b- F B4 A$ Z3 t
+------------------+-------+
0 a2 O3 q6 p7 n6 I) H| Variable_name | Value |
) U9 g. W: ?, c4 i+------------------+-------+
* m9 K8 X5 `3 z& A; ^! O| old_passwords | ON |
& q; J5 P+ o( Z2 x7 E& i+------------------+-------+1 u8 F4 U F7 b/ Z
1 row in set (0.00 sec)
+ M" L: K; h2 u! ~1 r" ?# @1 R
5 L6 `5 u) D7 t/ }old_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart% {& p& d$ e) R+ J
mysql prompt銝頛詨:
+ g& o7 ~. M$ u! @mysql> SET old_passwords=FALSE; 4 p& C$ N( v- R; k/ \, e
瑼X叮ysql.user 瘥撖蝣潮瑕漲:
9 C0 n5 Q7 b5 b" Nmysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;2 D, c) I) a* V0 ?9 e
憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣)
/ ~3 U' ~4 u0 \" c8 e8 \
8 l M9 m, O3 s$ H1 }* e3 i4 \9 D: Z閮剖靘撖蝣:7 x4 w( S& i3 n
mysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭
V* c- ^) }5 P- r6 L% q/ Amysql> flush privileges;
0 W4 y/ q9 Y; z/ S t# R, a6 ]7 o! Y2 E( c
頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣( M* V( u9 r& Z- \
瘜冽:2 W; G. J" y- k5 Q: ~# d
憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================
( j1 b1 x/ O5 F. Y5 B0 R鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:
1 |' S# Q) p. _# ~mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers( f$ s, r4 Y3 `' k8 T+ i" g- e0 F/ Q
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
7 P: q* H0 w- h2 J:- `9 G2 b* n* l/ P( R
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:. `7 L5 D7 R' N, @) `
vi /etc/my.cnf 乩:" `7 x9 x4 t: w% \" b' f9 H$ x
[mysqld]
1 w( i" z7 h/ C+ R' L" |! B& ^
/ N W, |* K! f7 T3 g- Bcharacter-set-server=utf8
5 T$ G( c$ k. V* ]+ ^# K2 edefault_authentication_plugin=mysql_native_password
- q! H3 k3 _' R& O ?" f# A! a. j9 T; Q# a$ b, D) x
[mysql]
4 s: I" W$ f" [' ^7 Zdefault-character-set=utf8- t* V2 s. {" V
9 P/ S! f' V4 t: X9 U4 C1 `
[client]- y* c1 r& Q+ w! i5 X9 i' b
default-character-set=utf8
5 V s7 @# b2 T/ z5 @0 q: V6 i
嗅mysqld
! V+ F. O5 h3 A$ fservice mysqld restart0 i7 c+ |! y( F, A
摰!!
& X5 p# m( q& r* t- [! [( H/ B% o" g6 d" e3 J
/ C" a+ V. X9 z1 z- m2 a | |
|