(1)1 |# m9 I* r" H& a( L6 n
php逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)% R1 A6 { V4 H- Y6 @
0 e$ [; g5 y3 h8 ^+ e omysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers( R& _* u: p8 W7 O% x) v! U
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers, F @ b* j) j3 |
:
/ j; r: v( r! g" p2 ^! J決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
9 M$ D: x) r1 b6 ?( ]. U/ K6 lvi /etc/my.cnf 乩:
- b1 O2 y0 K; R1 K! s& K[mysqld]0 i1 Y: s( O9 U- I& e4 T
- ]+ w3 Q& _& Z, s4 x. A% Xcharacter-set-server=utf8/ u* F( {8 F! V. C
default_authentication_plugin=mysql_native_password
* W7 G% [* {. `1 Kvalidate_password.policy=LOW) n. s( l8 u9 y" ^# m1 z% q# h" U
[mysql]
; b8 t% z! n3 {9 @2 ]+ {default-character-set=utf8
/ M, D3 h, z* R6 S" n7 ~0 C# I
4 P8 V, s0 O. y) p% R[client]
2 ]( g0 e" |& h( J9 Idefault-character-set=utf8/ _8 e- g8 Z' v+ [' M
2 [3 g' u; R1 w, U. c# u: B
嗅mysqld% N1 Z% U A2 J2 ~8 K
service mysqld restart3 a2 f% [/ u$ U* k
3 |1 F6 {' f; i6 v
敺航賡銝雿:0 F) d- r# {: Z6 S- w
mysql -u roor -p
2 A( E& }9 J J# ESHOW VARIABLES LIKE 'validate_password%';
. Z3 w+ `' W, d3 x4 g+ L/ G; [2 ]SET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!! e4 r( n- c) d) t+ P/ V. h
& A$ E+ w/ Y# [3 J% L/ f
閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~
, h. ~# T. l' A9 J7 |- <?
& [4 `( S: _7 j: b8 P9 i - $hostname = "x.x.x.x";3 {$ ~1 T3 z8 v- l
- $database = "db_name";" ^" I8 ~- \$ I3 u! q/ s; O
- $username = "user_name";' R. Q# H ]: O$ x& w
- $password = "pwd";
o! e( G7 k# k& ~7 G% m6 `
& V. e7 t- K3 l _ V1 H) `- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);
" F! h/ K3 ~5 C' @. v q, Y' S - mysqli_query($conn ,"SET NAMES utf8");
, J$ X" n" U$ f4 B% R" Q3 a4 P - * r' E4 X$ K: c' f5 D; I
- $sql = "select count(*) as total from " . "table_name";
" p1 ?6 K: ~2 X8 M$ Z$ A - $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));
: \$ A8 r$ m+ c- K' ?6 c0 A: l - echo $rec['total'];
f1 O* w6 C% n! m6 Z - mysqli_close($conn);
% L6 q y- W4 o" _6 n+ ^* o - ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0
* Z( x2 f2 a j+ V& i( G! \4 e) o _7 W6 ?- n
: i S, w6 _3 [6 c& q
酥hp 7.2.24 connect to mysql server,箇 : - PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:98 m4 V- p" x% ]3 b* P1 `; B3 v6 R
- Stack trace:2 C0 W3 S* n1 u! H( N8 D
- #0 {main}& @! e2 d8 J" q7 H' l
- thrown in /test/connectmysql8.php on line 9) ?, p) b% y* t- p" `* M! o2 P
- ( n! O0 Q% |6 m H3 K5 j8 G' |
- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
5 K$ ^& ~$ ~3 }& o1 M( E - Stack trace:
- h0 v7 f! r* r! A4 F - #0 {main}$ V# e: { e# [- C8 A
- thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳* {$ ~( W7 D$ r3 }
T) g a& O* C! r
f, r0 x6 O3 R E5 w. d9 K
[Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.3 S4 G( Q- v7 w3 b3 k. U' ?
隤芣: 砌賜批撱箄降"UTF8MB4",血⊥
* k2 y/ v" R! X* l5 U0 j* x$ M7 h2 y* @ Q9 R
(2)
8 L& f+ W# @8 o8 D# ~(1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'system>0' at line 15 h6 Z# O& u1 `6 d7 T2 F
SELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>0 f. t: _- U2 @' B5 |( ]
& D* ^$ l$ [7 L& d% h# H7 J7 K: [
(1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups = '' AND starttime<=1532077291 AND (endtime>=1532077291 OR endtime=0) ORD' at line 1
# V. Z' @! ~5 f. {SELECT * FROM forum_announcement WHERE type!=2 AND groups = '' AND starttime<=1532077291 AND (endtime>=1532077291 OR endtime=0) ORDER BY displayorder, starttime DESC, id DESC LIMIT 1
, }# Z3 n. s1 v8 K+ H. _
/ v. `5 K+ Q; W" ^/ N7 _5 [撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`
) x, M7 [/ A0 X2 X# g
2 h* X% M3 q, ^0 e) \- a蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗
1 k# \$ L b, D: z撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯
: ]1 P9 ?' n7 G& U
' r$ M8 \' S9 }2 C& t- j蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗% E8 X" a7 @5 P: _- r& t
撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯; A5 l* [( q4 o( {5 X$ [( y
4 b4 g( E, M" g% R( e憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊
& U" u9 v$ h; V0 [2 x& C+ n' D6 s6 v8 C$ ^ ]
箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦$ F% t% i, A) ]# U
隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊0 Z V8 V A2 ?- F" q5 P) g" g
* h T3 l% ~/ Y5 s/ M% F. h- U8 N% G, }0 v1 `2 p1 @6 {! n
2 U6 Y2 `5 m2 L# ~- a1 }* D: U3 ^5 b8 g( ]/ P
|
|