酥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').6 V1 w/ P% n+ ?8 W/ F
2 G1 y& m7 M$ W- s$ E$ y/ f9 E4 E( t臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊." c8 Y% E9 w1 F
閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73); K1 k6 e& }; T4 d. s R
餃叮ysql 嗅頛詨 : 6 n$ \; ^% R. N& ]" V' {* e$ D' S
mysql> SHOW VARIABLES LIKE 'old_passwords';6 e" M& G3 L$ P
+------------------+-------+9 t5 n8 }* W7 s( N+ k! E
| Variable_name | Value |
8 o3 r$ t6 q$ Z7 q: z% \; x5 d+------------------+-------+- `/ R% z3 B! D' R e; W
| old_passwords | ON |& z# d5 W4 T" e3 C/ V
+------------------+-------+% f# G0 P' ` r+ b5 G& R
1 row in set (0.00 sec)
. }, q7 o' r# h* [; X, y' j- G6 g# V+ a
old_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart0 F' e8 `" S4 w7 j: ?6 Q! F6 l4 m/ x
mysql prompt銝頛詨:
% ~# k* C( O7 G5 ^6 U$ x+ emysql> SET old_passwords=FALSE; 5 u. @1 g7 g' U
瑼X叮ysql.user 瘥撖蝣潮瑕漲:; H- S! P9 r: r9 {0 t2 I" Z
mysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;
4 M7 s q( F: n8 a# d m. n! j憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣)
- ~, l: [& {8 r7 [3 I( l6 ^9 _' u! Y/ ~
閮剖靘撖蝣:" O: |7 g K$ W5 {
mysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭
! O1 u! o$ Z' F6 C9 M% O0 Emysql> flush privileges;
3 p' X# N6 u; ?5 O, Z% x) [6 k5 C# M; c* A, j0 V$ x# ?
頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣( }& R+ X9 |3 S* u# B6 J
瘜冽:
* A( I3 p2 _* @憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================) m! t; _& n1 g6 U E
鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:* T7 c1 n/ M6 n+ t
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
, h% L2 T! u" \5 Vmysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
9 D: H" h2 p8 z) Q8 m. U:
; ?1 B0 b* y9 O$ t$ s2 Y) D Y9 K# W! |決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
- g3 Z& m) V. [* Y0 N$ }vi /etc/my.cnf 乩:: C' |. m$ {3 |. w1 U% H
[mysqld]6 G* h! u( j% F
& |, d+ F4 V! P
character-set-server=utf8) `: z/ U. L/ ]
default_authentication_plugin=mysql_native_password m& ^' s( r2 M# T
, X+ I5 x) l% \! {, i% H[mysql]4 N& o0 T x* F$ r: E- i; h
default-character-set=utf8: m) D6 n- p2 P" w) p3 _
- Z: E1 ~+ s; R: ]+ U. v[client]
, F3 E, ?4 \$ |/ Hdefault-character-set=utf8
, P g3 q/ l4 r8 Q0 _% n& j1 _- N: W, w3 Z
嗅mysqld2 x _4 G9 R' H: N/ O: n
service mysqld restart0 I$ W! a5 E2 g6 K# x6 g
摰!!
- P; H8 k: _6 c) u5 w5 m! I7 L" L3 e1 v) W
2 l" D3 p0 X. R- f3 O
|
|