酥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').0 Y8 u0 B z, x7 r
- n5 N" P+ L% ?) f臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.' R0 U9 X+ C- {3 L# ^
閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)1 o+ k& r! [* T1 r# [% U0 ~, h
餃叮ysql 嗅頛詨 : , f4 `4 L9 m1 A1 ? h" G. M7 ]
mysql> SHOW VARIABLES LIKE 'old_passwords';
; b7 Y3 A+ v8 x0 e; I+------------------+-------+0 q0 }2 ~9 i1 F+ [% u
| Variable_name | Value |
% |$ x8 m; ~1 t# N* Z9 `$ u+------------------+-------+: v4 O% o" ?( }+ f
| old_passwords | ON |
* {9 ~% G: y* Y+------------------+-------+
4 ?. h( M$ \6 @1 row in set (0.00 sec)/ @9 T6 w L) M/ O" x- X! }
- Q& U6 ~& |7 x/ N( l/ p
old_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart
4 N4 v' i2 w, i* d; h) S mysql prompt銝頛詨:3 X" p8 S) b8 H/ n( U
mysql> SET old_passwords=FALSE;
4 U& J7 r2 P0 N) I+ }/ b1 N- J瑼X叮ysql.user 瘥撖蝣潮瑕漲:
4 B3 q" W" A# |$ Lmysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;
6 K5 G3 ]. l; J D: \/ n憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣)
' {5 b& z; g1 g# p R
: H% `+ Q2 F9 ?# C. ^% ]閮剖靘撖蝣:2 ^$ P4 [ p. z1 o1 h- f' V$ L1 h
mysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭5 d3 T! J+ s' G
mysql> flush privileges;
7 F: f! d& w2 [+ I. I( B, H- B9 {
* {1 j+ L" e- T/ I5 E頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣9 G. X$ u+ ^" J9 w: Q
瘜冽:$ l( e1 D0 X# l) o$ r# Z$ Y
憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================9 O! P3 r% j& L
鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:; O( l# r+ ~ G& e2 ^% M% C, f
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers" s- S5 u- @ |" E/ j
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers- ?/ U! I4 C8 g) i/ R
:8 ^+ _% L O- e) U1 r: t$ o9 X# s
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
) D- y0 h; I; q8 s7 s; _, ~vi /etc/my.cnf 乩:
) j/ a: i0 p1 O- y[mysqld]! r( k6 r3 B$ j I6 n
4 Q" A4 R- ^' @0 s* @& |
character-set-server=utf8) P; Y, A0 y5 \* s
default_authentication_plugin=mysql_native_password1 |9 s' y" W' f( O1 _6 i! n' n1 V% b. q
: r$ g# \, D! t; H [1 h
[mysql]2 p0 C+ w- t2 V! i
default-character-set=utf8: j; i9 J, u! e: A9 n' P5 \
6 h. P, S" k1 d. r1 e
[client]
& t2 ~) k# S1 edefault-character-set=utf8
u4 d r& G% M; t+ }
' F* f7 t3 C+ A& X, _. ~. |嗅mysqld8 x {) i4 v* M7 n# ^
service mysqld restart
0 s2 A, Y2 H8 h' D3 m摰!!
: b8 g% A. X7 y' [& P8 T; S. o% J e, M* X* U4 D( H' V1 v$ A
% p2 d& \( Z6 S- D+ `) x/ b2 n2 k* D
|
|