酥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').
9 B _4 t+ a- R& r$ a1 d l5 |/ Q
臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.* U& w' o4 e j
閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)" \7 ^3 m; D0 v
餃叮ysql 嗅頛詨 : % x6 c5 b4 H6 b: B. E2 \
mysql> SHOW VARIABLES LIKE 'old_passwords';
6 U5 k. {* u% E' @# X: e: X. J) U+------------------+-------+' n e- a; \& ~' M% W
| Variable_name | Value |; |1 u' e. C% ~' p/ ^( p3 ?) K$ J
+------------------+-------+& O. z' t# H0 ?. Q9 v6 R/ p
| old_passwords | ON |
; j4 {! D1 b2 S0 i& m, G" O/ V+------------------+-------+6 G7 e+ }# p) Q8 |! ?3 ?$ S
1 row in set (0.00 sec)
9 d$ I9 T0 J8 z: u( {( f/ K/ u
old_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart& w- z& {2 ]4 E' I
mysql prompt銝頛詨:5 m& c8 ~& X. S
mysql> SET old_passwords=FALSE; ! p, I+ d, J2 o
瑼X叮ysql.user 瘥撖蝣潮瑕漲:
5 c1 `+ i& K. S5 }- g" h ]# Qmysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user; X2 q1 L% X8 \6 k# \, q7 x
憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣)
6 D4 W0 D6 L3 G+ ~9 h: Z( u
9 n! n& ]9 P1 A: w9 |' s2 O& b閮剖靘撖蝣:
+ |' @/ `- i( `1 `4 Smysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭
) H& F8 b7 B# K. e! Wmysql> flush privileges;4 R4 F- P4 S% f
# m" B6 D4 y7 n& m
頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣
" \; H4 g- D% X6 [瘜冽:+ \3 X9 w X/ A' f
憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================( u2 r* J! s) \( _9 D
鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:' ]/ m3 M3 l& Q
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers x4 ]* r- n0 ^1 S0 Q
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers) x' E- i+ n; ?9 d: _
:% P+ w8 D) j6 m/ [9 ^2 X
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
9 Z; _1 n( g& k( R! i& U+ N9 P# Ovi /etc/my.cnf 乩:
1 R6 h! o Q* Q7 F[mysqld]
1 i! Z# A) b/ }. U( a( Y. S- C+ V, M- W$ p; D! L5 o7 }
character-set-server=utf87 N. \: {+ D) l
default_authentication_plugin=mysql_native_password
3 f, X2 B; o9 s4 q" h
! B3 r0 Y6 Z. w2 Q+ ]/ P. j[mysql]2 d# W, a% p% Q
default-character-set=utf85 J; i% s) \$ a3 y3 v$ a
) N7 v, ^ P2 h/ M; ^6 N[client]
8 e- `1 c4 n3 |# Edefault-character-set=utf8
% Y. }3 }7 d- @0 P+ ]3 ^: S0 z; G
嗅mysqld* `' c) v- `$ y& e; }
service mysqld restart$ O4 b' s* k! A4 f8 q% V1 S! C( p+ E
摰!!" h- D4 ~9 F( c
% n7 v: z* |" h9 I0 I
+ F0 u2 S( U: }* | E) G0 u5 {
|
|