(1)
! E7 q3 k7 n( v0 \/ F& [( }1 r5 D2 gphp逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)
3 _" z7 |! s3 j& U; d! B! o& p# y) c, I# T& n
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers' F2 v! ]; X; b9 r
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
( e) O1 ~ _ O P4 ?! R:
7 Q% v$ H* C, h0 d- B. |8 h# a決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
. W* {: X @4 f7 j- A; C7 e8 Ovi /etc/my.cnf 乩:
% u6 _9 H5 X5 u, Y9 {2 H' g" Z9 W3 p[mysqld]
7 e( k7 F4 `, z- b# ^4 R$ Z; [3 M+ n8 V1 f4 z4 B3 R* p
character-set-server=utf8: d/ Q# W. l" N) c8 c0 f, U
default_authentication_plugin=mysql_native_password/ W A( L2 e+ { m' W
validate_password.policy=LOW
' a) X9 D5 _5 Q) F% Y# |[mysql]
9 Q$ x* p$ Q1 \) Ndefault-character-set=utf8
( E/ V2 d8 m: M/ d, i
. K: q4 r8 o( `' S& Y& w[client]
6 Z& ^. S8 k4 Z, sdefault-character-set=utf8
* A& f( j! r! ?0 P
- u5 f" J6 C( v+ C" i嗅mysqld
) j2 P3 _; |6 N! q' g3 \/ ~service mysqld restart
1 s6 N/ u: U6 r' J, C3 j; U, `3 u0 f; ]
敺航賡銝雿:% J# s8 b) U! @9 n6 _4 m
mysql -u roor -p , H6 u+ w# ^) h0 b' a8 i
SHOW VARIABLES LIKE 'validate_password%';6 B0 d- j/ x# {
SET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!
/ k+ v: X" s0 r$ Q5 l ]4 ^9 ^$ ]
0 Z4 W" R( U9 G8 i: ]閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~
6 T7 ], X6 }9 _' S- <?" ^2 U% k! W4 Q+ v
- $hostname = "x.x.x.x";* Z. y( }2 q, X; n# X) s0 i
- $database = "db_name";
4 `5 h: ?, C; a# R1 p E - $username = "user_name";
- Y& y6 H3 f# P* E0 j - $password = "pwd";
; W5 h, I' Z4 R# n4 l
h( z, X3 S& Z0 }- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);
6 i% J! d% c: {$ k - mysqli_query($conn ,"SET NAMES utf8");
/ ]+ h$ T& _4 x
( n& E0 {5 E, Y7 O/ m& f& L- $sql = "select count(*) as total from " . "table_name";
# c: z. ~6 J( W3 K0 k% G4 w - $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));6 g; |/ q w' i( S j }
- echo $rec['total'];' P7 m4 y3 w, @. M$ N. m9 V! I
- mysqli_close($conn);: V# U y0 U& `1 z3 |1 i
- ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0 7 ]3 x& d9 a2 e( h) M
9 ?# R+ r9 Y/ p) J7 o) }! j x' y0 f/ h3 Z
酥hp 7.2.24 connect to mysql server,箇 : - PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9; J" }. @, k& M/ Y9 | x. x' l
- Stack trace:
4 B( T% E% \) c - #0 {main}. V2 }( L0 Q$ A2 J7 P
- thrown in /test/connectmysql8.php on line 9
* x6 W9 l5 |( y( ^7 L! X
. V8 V& o7 f- }' I1 \% ]- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
7 c' h$ R/ r. T* H3 s - Stack trace:) i a0 c4 h3 t. [
- #0 {main}6 y, b4 V0 t; f% g! v4 ?" V' `1 M
- thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳
2 M# ~0 _ G$ g1 W8 [2 X$ S! M
/ T. z% s* p3 C9 A4 v
' \2 `8 n6 M9 j[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.7 [8 Z3 M/ A; t' D" T& W
隤芣: 砌賜批撱箄降"UTF8MB4",血⊥
6 n! b5 a( Y% R+ Q
) Y l# k2 z4 n! s! q+ f) e9 l(2)
% M7 u5 A4 ]" U% h(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 1& E! h. t' z! F6 O4 |
SELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>0$ p' M9 r0 ~; A) m( B6 B& D
! d" j" `8 J- G3 o) @(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 10 o' b- F% ^+ m; L2 z' ]
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
2 _+ H3 G: v+ ]/ r* i+ h$ P& C! D2 W4 P7 \
撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`
; ]6 ]/ }2 J" u, _) d3 m* X M2 Z% g' e
蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗
- F! e6 V' u+ J撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯8 e' b( ?* M" X, s5 A
; ] {6 e5 B3 s! w4 e% j
蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗
' Q( W+ M ?9 y# a" v" A, w撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯3 I% [& {8 l% h8 m8 n9 r" c2 L) `
3 f4 p" y f6 W+ |* F憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊. {5 M4 _1 C# K. E! U. Q
( ]6 B, R( t+ a$ q. b箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦! i2 B. v1 R0 H6 H
隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊
! Z! D- A6 I9 l# R+ G3 ^: F1 i6 f$ _
. V. n) P6 y3 P4 {) N4 N, H" D0 A
, [+ E. v' w5 Z$ v. S9 w) |0 p+ U. Z! h4 o; y
% f* Z- c1 r5 t; j; i |
|