酥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').0 V+ ]; f/ Y- I! C( f: |
' u! L$ ]0 [8 W8 E* y& ~臬歉hp 5.3隞亙撖蝣潭16雿蝺函Ⅳ,啁php 5.3隞亙41雿蝺函Ⅳ,mysql 5.2 隞亙閮凋16蝣,隞交甇斤車航炊.
" g) G9 _. V# [2 ]2 |$ V$ S閮箸瑚銝mysql: (php 5.6.38 , mysql 5.1.73) D% m* u( N; s& ]6 Z1 z
餃叮ysql 嗅頛詨 :
3 a* I+ _5 E# p! Tmysql> SHOW VARIABLES LIKE 'old_passwords';" H4 R# T0 q3 P# a+ N
+------------------+-------+; p" r" `" }" J8 O8 A
| Variable_name | Value |1 y- L' h0 G; E5 e [2 O3 Q; p( R
+------------------+-------+. }& U8 r4 o( C( R: F, C
| old_passwords | ON |
0 E* r4 M9 n9 W- ^% M9 B: T' m+------------------+-------+
- I; x% k6 q7 b$ |" t4 W. Q8 U1 row in set (0.00 sec): h" }: P4 R% T. w' d+ k/ ~2 \
3 H; D& Z! e4 U) Q1 [' n' o5 [
old_password ==> ON 撠梯”蝷 /etc/my.cnf 鋆 old_passwords=1 閮剖16蝣,撠摰閮剔 0 嗅mysqld ==> service mysqld restart* F+ v# G2 d e7 j
mysql prompt銝頛詨: d, U, }2 Q& i
mysql> SET old_passwords=FALSE;
4 ]' D* W. c, A9 Q( ~; V瑼X叮ysql.user 瘥撖蝣潮瑕漲:
( t8 f: {! }. }+ j9 Hmysql> SELECT 'User', 'Host', Length('Password') FROM mysql.user;! `8 ]8 @( O/ j% S, R
憒瘝寞41雿,Length('Password')甈雿閰脤賣160(銵函內瘝閮剖蝣)
( _( F! L: q9 h {( M: ~; \$ b) v: L7 o" m
閮剖靘撖蝣:2 c) T- o0 y n$ x# S/ D9 c
mysql> SET PASSWORD FOR 'root'@'192.168.1.1' = PASSWORD('靘撖蝣'); // 撠敹閬詨靘 撣唾@IP 湔,銝閬寥臭* t: F" ?% e) N2 T
mysql> flush privileges;
0 J7 y& o* }! W; \2 J, r- r- b* ~7 J( b2 n" G5 P1 n
頛詨 SELECT 'User', 'Host', Length('Password') FROM mysql.user; 瑼X亙蝣澆漲,撠勗舐潛曉寧root 撖蝣潮瑕漲撌脫寧41蝣
\4 S* C! O6 x) {: l: {8 d2 n3 V瘜冽:
) J, B' `% I$ F; f Q9 y$ f憒撣唾憭芸,臭誑啣憿閮剖蝣,粹閮剖蝣 SET PASSWORD FOR 芷撠亙蝣,銝 old_passwords=0 撠撖蝣潮敶梢===========================================================================% I- E- l! _! p6 ]2 S
鄉ysql蝝 8.0.21,php逅ysql箇2銵errors:9 k. o Q1 C d( g/ O2 W0 y
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
! \% {3 n& z: e% u3 amysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
$ f) F4 N" r4 z$ q* i. Z:; a1 L1 }/ r, j& j
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
3 l# m) b, E; y5 y, cvi /etc/my.cnf 乩:
1 f6 f: X4 |8 d" C' N[mysqld] h0 p0 h9 A4 \
* f2 N$ B6 @! L" H) b9 h0 `+ Wcharacter-set-server=utf8
1 D. a6 z, l+ K# V4 `4 Rdefault_authentication_plugin=mysql_native_password8 @4 J% E! u$ J* m
7 V ?3 C% r9 D/ v5 z7 y
[mysql]
* p: P2 \3 Q& o0 [( v# P: Pdefault-character-set=utf8; Z8 D" K# x5 e. j/ a# K5 s1 k
, u# H7 j W, H[client]
`3 {! t! s; |2 hdefault-character-set=utf8
6 \. h. u2 z# p4 g" | \- L5 P' v4 J G+ W8 I& J
嗅mysqld/ L1 A, Z0 B0 q) o6 H! [6 |/ V
service mysqld restart, L4 C; d r7 g
摰!!
2 g: m2 N, L6 P- P1 W$ X* W
' e) a- o7 @( u" |% i4 m9 R) r3 f. v2 ]
|
|