(1)
$ T3 Q. z; j b6 ?/ r; d; z6 qphp逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)
) ?' ]2 d6 e1 C" ~1 e; X# O$ }% `# D) K+ I
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
# o+ {5 Y4 M8 x9 d. v1 mmysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers; o2 X; ^3 M4 T. {: ]
:% z" `( h' W5 u9 R( R8 |
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:' a4 A! g! ?/ N+ [+ a
vi /etc/my.cnf 乩:
, a4 G J% a6 b[mysqld]
6 n& j+ S# R" n0 L
$ p: `; f9 ]/ ^% j1 a zcharacter-set-server=utf8- m" A9 n( ^6 r' O* Q3 a o" H8 m* {
default_authentication_plugin=mysql_native_password2 i/ ?$ ?) I C4 @% F* F! G
validate_password.policy=LOW4 @3 Y, c) P ~; x( J
[mysql]5 V n3 h5 p9 g7 O) n- M1 z: q
default-character-set=utf8) z4 ?- a3 M: z
o: h7 ?9 g) Q4 D" `8 ]' I
[client]
8 c; f* k; m7 {8 |default-character-set=utf8
/ x" o" u2 z7 A3 k* v9 G. ~$ C1 x- G! X5 G# y: a% U& [
嗅mysqld
( U: ^- i! k: @5 t% m9 |* {, w' Jservice mysqld restart+ q5 U" F$ s, g9 M5 J( g
7 |- B! }2 t, H ?2 J) Z敺航賡銝雿:- M) o( S5 q5 T) p- C
mysql -u roor -p 9 p ?/ M/ Z" [
SHOW VARIABLES LIKE 'validate_password%';4 B5 ^( D5 b) {" R5 ` f
SET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!9 H4 H( Q9 l" c% r1 _
, L5 n6 l+ t; R. q; K$ E/ n6 Z
閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~
5 W1 u7 E# j ^- <?- o! l: O, T- G
- $hostname = "x.x.x.x";
% v1 n- u( K. g! P - $database = "db_name";5 Z( o% W8 B2 C
- $username = "user_name";2 U: x( c; H# j- q& s" `, A
- $password = "pwd";
, j3 e! _ B/ N1 J$ } - % v6 P4 b o' _, j6 c3 T
- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);9 @; i. C' r0 f: `4 W
- mysqli_query($conn ,"SET NAMES utf8");0 p# B" P- K. O2 n
- 0 d6 r; n! d0 @3 N; U; t
- $sql = "select count(*) as total from " . "table_name";& r# J8 U C M% U0 U
- $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));4 E# Y% D, z8 x
- echo $rec['total'];& P( Z0 f {( P6 R5 i% e0 O3 o5 O
- mysqli_close($conn);2 ^$ ^1 F% u+ Q' Q5 {" r1 m
- ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0 7 q% M* Z3 _% V! d" C
& o& R; t* R9 O+ Y0 _8 o! _) h+ ?0 t% G' d: x
酥hp 7.2.24 connect to mysql server,箇 : - PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
) \9 o' R. a8 Y: r - Stack trace:
( S% V, o9 u+ Z. _9 t2 x0 C7 f - #0 {main}
& L P" v( S( g$ M6 a7 B# ? - thrown in /test/connectmysql8.php on line 9
; ?0 o2 H y6 `
5 _5 v2 S% a# a- `! |. _- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9) P+ |" [/ ~& y0 _( {3 B* \
- Stack trace:. T, N# I# _5 {
- #0 {main}8 ^9 D5 u0 q: k& }9 H7 E7 K
- thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳
+ V4 m4 a! _# C* {# f8 q* N j4 S! Y2 y/ T9 p
! V& K+ [( Z; u# \6 P( P0 R
[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.2 D5 f2 r ^+ o% q
隤芣: 砌賜批撱箄降"UTF8MB4",血⊥
# n& y$ O/ F) c% b; r
( d' {" h& R. O6 P+ `(2)
, m o1 i: _! s" B" i: 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
2 y# i# U0 ^, C- r% n! h# D5 @) e3 ZSELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>0$ S* I% r/ S( Q7 O z
" `2 F+ Z% u C6 C. p
(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, q* W. t) `# C0 }* R
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
5 e- v# C, h. F! `$ Q3 l( `/ a. I0 @4 \# s9 x
撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`
! V& }: H, d) G7 U% i
: N: b+ [2 O( g1 k蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗
, f+ V# q3 i4 l撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯
/ g$ f2 I) P' m- k5 u+ ?# }, M6 p- t# B( }# t$ n
蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗
{7 y, O* P! A. w2 Q9 W! H撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯% J7 r/ Y# \ \$ o1 h
3 X# ~; z2 i3 k: k
憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊8 r' E1 h8 X9 b& P+ L
7 R2 t% d0 d% d( k" y: w) D/ }$ G* x9 C
箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦% v7 k! L8 M. P' B$ n, [( }
隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊 ~8 V$ S, q- S4 W; S9 J1 y1 L f, n
5 [ e! _, W/ d2 h5 v8 n4 M
- f! e% x, m. l' [! D) n/ @
]! t: S6 s) ]0 ?+ ~( ]4 s2 l* {4 s" |6 r8 L2 v3 c: V
|
|