酥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').
8 `$ x4 Q, g+ g, M- t" t+ r# \# a, d; d
臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.
# M. \8 {/ Q! Y+ E閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)
8 g! G! i4 ~1 c8 I, U$ O0 h% D# i$ l餃叮ysql 嗅頛詨 :
) T) }( L, D, y1 @, m$ Dmysql> SHOW VARIABLES LIKE 'old_passwords';" _# i+ b7 H$ O, L
+------------------+-------+
: F; o2 U- S% K/ l| Variable_name | Value |$ w1 c2 N( _, M4 W
+------------------+-------+4 z3 ]9 z9 \! w! u* {
| old_passwords | ON |
7 K7 S& F% g z% K5 t2 o9 N+------------------+-------+9 f' S, }( G N- e
1 row in set (0.00 sec)6 ?( O/ n) T$ ?4 |) V% N6 z+ C; b
% o; ]6 k9 Z/ J2 Z3 X9 c" ]
old_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart6 _- n% o" y4 G4 R
mysql prompt銝頛詨:, ]) D: a: P6 w0 A
mysql> SET old_passwords=FALSE;
) h- t; u5 q: W. j) }2 R瑼X叮ysql.user 瘥撖蝣潮瑕漲:
+ m# F$ _9 p* |, ymysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;9 C& a% W. H7 L9 l) P. z- k
憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣)
- H1 C. e& ?/ `* `7 X+ ]3 t( V4 u" f- J
閮剖靘撖蝣:
& Z) S" O; L' A' D4 l2 O* qmysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭6 }( J' c% n5 i& z
mysql> flush privileges;
, E. Z' b. N5 U( B, Z" ?
( p" C% m& _, [5 A2 _ m H+ ^頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣' k) A" Q" T* a" G7 p
瘜冽:
: j- e$ m; F# C |* b憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================
% K2 r* H$ R$ n4 u( G鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:6 h8 c2 N6 u/ g ?8 [8 h! t \7 z
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
1 W3 g% L; _, {' G0 O% f1 umysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
2 o4 E$ \- R" Q, k:
$ \- [4 ~3 l( ~+ ?, ~+ }決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
5 c" U4 y6 J" y0 Q+ x$ Uvi /etc/my.cnf 乩:
2 U" c9 t5 R, S& A3 c[mysqld]
( Q7 f7 @6 C5 ?# v
7 ]7 b: v9 Q }character-set-server=utf8- J; z5 `( H0 c# H- J6 e
default_authentication_plugin=mysql_native_password) ~9 q% C. T) k
* H c: I9 b) u, z4 H; Y% u
[mysql]. z+ J( X7 y5 g7 v1 `
default-character-set=utf8
' c: _* L/ o4 D- ^+ L! M8 ^6 q( }9 I4 M/ Y8 n
[client]5 o/ Q8 A t! D7 V; f" S7 Y. o
default-character-set=utf8! e' `. y3 y- P2 m" l
B$ U3 r- n2 o Z/ w2 o嗅mysqld1 h) \9 K8 P1 I
service mysqld restart6 @( ~6 J: V- w8 s& m, n
摰!!
5 H$ [: j3 W/ M- @6 }; B- ^- O5 b' N! n- ]
* x/ E: F* B' W, V- k% {) u' Q
|
|