酥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').
' {% Q6 S4 d, U/ m3 P1 n
$ ?9 G* E$ M6 c- ^臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.
+ U. _8 \4 S- H' f+ r0 w閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)6 j0 B4 ?) o" ~2 d0 T9 H! m
餃叮ysql 嗅頛詨 : ! v5 H$ v; S% s7 `* ]# \" W9 F
mysql> SHOW VARIABLES LIKE 'old_passwords';2 w% p1 p+ c( Y
+------------------+-------+
! [! X* O' g( M7 X! C5 ?3 _| Variable_name | Value |
, k7 ~6 V( _7 A" G+------------------+-------+ K y, q7 D- P8 \2 [1 g9 V
| old_passwords | ON |9 t3 I; {0 H7 Y0 P3 p
+------------------+-------+7 _: _5 C! G7 ~+ F9 Z. q
1 row in set (0.00 sec)
- r( [" w4 z0 m$ a
( N; Y0 K9 c7 @4 w3 f7 told_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart
" S" n! j/ T4 K: a mysql prompt銝頛詨:
* d' A! T! ?- |8 D/ n/ x3 O' zmysql> SET old_passwords=FALSE; : [& e7 S& F; x R$ W
瑼X叮ysql.user 瘥撖蝣潮瑕漲:* _# Q+ T# |: }; t3 B2 E
mysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;( s+ c9 b+ ~. k9 L, i
憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣)
' ]/ [* i7 z$ l$ n, y) F
* {7 @8 B. n' z. c閮剖靘撖蝣:
9 u: Y5 ?; Q1 umysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭- s$ d5 ?1 t& O" ?* T
mysql> flush privileges;% k1 a8 K! M9 X3 ]
! a* d" Z* R$ ^3 F9 B" L頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣, e. f* ^% y0 t
瘜冽:
: Q' V+ s7 I- s- `% i; b% O/ k8 M憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================* I: z; @2 K* d" k* U% S- T& j
鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:
$ _6 c3 N1 ?2 p; T+ i# w6 h, a. S2 vmysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers4 W' Y/ F8 f) V& a" m
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers4 x1 n7 c' ], L! F( y ]
:" d" g6 O7 l: q3 ~, {( F- `
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
2 {5 w: ^) s4 `; D( J- _+ hvi /etc/my.cnf 乩:5 M% T* i& \) W% [: R: t0 D8 n
[mysqld]. g4 W$ k6 T, |
7 l5 ~: A6 \" q( jcharacter-set-server=utf8
) {% t' j$ d/ i& c& y* g* b0 R Rdefault_authentication_plugin=mysql_native_password
) ?% B3 {7 r2 w0 `6 [+ \0 R; K8 x
( F' f+ W2 a8 e/ C, h' O" b5 N[mysql]
6 s- e# _9 l4 @6 g4 J" l5 ddefault-character-set=utf83 b- c/ R6 W7 ~! S' M; C4 I1 t: ]4 N
, j; T; v L1 U \0 P! c[client]
$ E1 Q+ w7 @) e4 {+ `default-character-set=utf86 W% b- N+ r% c
: H" S- v9 Q: t q5 |/ X3 [$ p; v
嗅mysqld1 F; K1 u* _& g& T# J
service mysqld restart! S/ p/ g+ [! k) V$ Z/ f/ I/ ]
摰!!/ t3 _( [* P' z8 ?
6 W3 K1 \, Z0 x% j# d- M+ ^* k
# M# K, C0 U2 C d/ K7 ]1 G- |
|
|