酥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 n: ~4 u" t' K/ ^$ W
( C4 ~; c& f, I4 \+ L' C/ M- L5 J臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.; N9 O8 J5 Q3 `3 i3 w! J0 g ?
閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73)4 P7 r7 ?" g x, ]0 |' g. W
餃叮ysql 嗅頛詨 :
: T, X. G0 E6 x: c" g3 @mysql> SHOW VARIABLES LIKE 'old_passwords';
( B4 R# I0 j) B* O+------------------+-------+! k1 j) b7 B! w( |4 B4 A6 d" S$ r
| Variable_name | Value |) W0 I* |1 y+ C; a# C
+------------------+-------+
+ j$ B \/ |) O5 r$ Q| old_passwords | ON |6 i& h4 @# e& }, m+ t
+------------------+-------+6 m/ ]5 o% X( `! v
1 row in set (0.00 sec)3 I _$ e2 u v8 }# Q _
! U: x { C! k9 S% H
old_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart/ j5 B+ k& T" n/ q3 `
mysql prompt銝頛詨:' D4 \ U! j c1 _9 J1 S# `; \
mysql> SET old_passwords=FALSE;
6 P6 e4 o# w( N8 |2 r8 f- g瑼X叮ysql.user 瘥撖蝣潮瑕漲:
6 y4 c0 V$ E$ `/ b9 s% X' `mysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;& S5 c# ]! y E3 p2 W
憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣) - @; E( A2 L8 h4 ^9 M. D
1 E0 z9 Z5 i, k. c, k閮剖靘撖蝣:
: v5 v; G V- ?' ^5 ~; kmysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭 g/ P- \/ W) t0 a! n
mysql> flush privileges;1 J2 @' v) f: G+ S
0 l: _; M2 x" `- D# {
頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣) C* M4 a8 v+ z3 d5 E* m8 `
瘜冽:& l* R# T# p. M) F2 u( N3 c
憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================
& I$ T+ x2 A' o; K* r鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:! q+ s, {1 m( c: G2 B
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
4 l7 t: C* J. w- t$ m- c# Tmysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
, F: n* `1 u0 x& l:
; k9 n% p: ?0 I# f5 l+ V# Q& B' O決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:6 ~, G, c4 d, {* M! l9 `
vi /etc/my.cnf 乩:
$ y; |; b! f9 E, b% S. z$ p+ W* P[mysqld]% z2 [& \4 j% C
" u1 w5 f' l( \; x$ |5 ^$ l
character-set-server=utf89 d( ^/ C& T" a" D' m) g
default_authentication_plugin=mysql_native_password
8 H0 y+ A- b. C- G( B Z, N4 L: _7 F8 b5 s8 S3 y6 W- X
[mysql]
. I: Q- i9 D9 S5 zdefault-character-set=utf83 O8 `+ \( Z0 H( i- C
* n) ` `( q4 p# l& V6 D& Z
[client] l$ k1 q, U: d8 d, i- d
default-character-set=utf8
, ^: x1 y6 O) p4 M' b# s, Y$ o' [: w/ I/ \5 z, j
嗅mysqld
7 m4 ~% Z& h# c4 X2 x. {service mysqld restart- z( T: `$ l H3 B
摰!!
2 \ k4 f. Y, l3 o0 \! ?5 z% R: H" k' v& H8 O- {4 L
4 ~' H1 w! Y8 T6 E+ D* ]/ p
|
|