酥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').3 r: i. H9 t3 a: N
& U0 t, \! N+ ^+ V3 q0 O
臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.2 K) v- s% B9 l3 ?2 K
閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)# { f" l# E( `3 T" G7 U
餃叮ysql 嗅頛詨 : . h2 { m$ o+ L6 H
mysql> SHOW VARIABLES LIKE 'old_passwords'; c, g8 |$ L) f" e( ~, _% P
+------------------+-------+
- Z9 C3 `1 b8 ~. V7 a# `: d| Variable_name | Value |" I, _3 J! Y+ Z; K( u
+------------------+-------+
7 u3 N( q1 U3 T& j| old_passwords | ON |( y( g+ D; X/ O% [* m I c
+------------------+-------+
# G) P; |, J9 t# v' ~3 _1 row in set (0.00 sec)4 g R: x( N! c* q0 l% p
2 p- Q7 {. ^' A$ l4 M
old_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart
& M1 A& R- q1 b mysql prompt銝頛詨:
. U X3 B4 e/ j- ^mysql> SET old_passwords=FALSE;
. H g+ P' M' Q3 a2 D瑼X叮ysql.user 瘥撖蝣潮瑕漲: _) _1 x( f& A) ^' C @; Y
mysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;( h' U( H0 P: G) }5 P4 B: Q0 I
憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣)
: Q" ~2 v0 _! Y, a6 k' P. U/ g! }/ y0 P
閮剖靘撖蝣:
?& b8 b2 @* `" i4 {mysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭7 v) N1 b& ^" _1 B. A) ?) k
mysql> flush privileges;, E& L' H/ c) k3 B- z( U1 @5 |
% F& |% U5 B! b( A
頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣
; g2 ]. L4 o6 [( L' o瘜冽:
" p" C q$ s+ _6 S* o: i* R憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================1 Q2 O9 j( W; i) @) Y0 n1 h
鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:; |! H5 N0 d) B' A- h# z
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers. S( m1 _) B, o) {- ?
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers1 ?- U- r9 n {" M
:( `8 D6 H" n: w ^; [ c
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:0 R2 d. C w `5 M5 G. f
vi /etc/my.cnf 乩:
8 O0 l' S0 N, W0 _- A- l9 O[mysqld]5 b9 V! M3 K& C9 f, x
- L) C4 ~- U$ e% w0 B1 W) icharacter-set-server=utf8% w4 }4 i6 Y% e* D
default_authentication_plugin=mysql_native_password; ^+ g; M5 g& D( k/ Q- T0 g
- o+ R6 U9 P! G/ `0 X; I[mysql]
' \# t i, L. a& Tdefault-character-set=utf8
9 f- w5 I' ]' {. _8 h& u/ E
3 {5 ?( }, X# Z6 u6 t[client]
5 a' }8 _3 J. Adefault-character-set=utf8
3 Z( V# g' i+ N+ W$ b. O, q( q6 u4 ~% H- L* r+ f
嗅mysqld' t' D! e* y, W: A1 L. h
service mysqld restart
$ y" A( ?( t- O' a( a摰!!
* \5 R# o' B& H+ e* H4 f) x% w* ]5 O$ f5 y- o+ K
- V5 W8 d" {- `! P) n
|
|