(1)+ [7 P8 f& n$ ]" p8 j2 Y
php逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)! E/ F3 g- C! t7 Z' Y
! ?) R+ ]9 C1 Q8 @ |, N
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers8 x3 X) [$ ]) n
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
% i# U: J8 d& [ Y* _:
0 K. \) u( M9 z8 i* ]決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:% q% z, U/ t* ]! v; n4 F b
vi /etc/my.cnf 乩:- k1 _' B- X0 p) L0 b: V
[mysqld]
9 W$ N7 l7 T6 N' l: R0 d
* |% }! p' @7 ycharacter-set-server=utf81 g( X# h$ |+ [9 q
default_authentication_plugin=mysql_native_password
2 g' \4 k4 y* q& U+ M( Evalidate_password.policy=LOW
- u, |2 K, @- E# m7 i! M[mysql]
3 \+ c; y) M( `' k6 Ydefault-character-set=utf8; b0 h$ s' y2 ^* A6 N& Z
4 M y$ Y q+ [( ~: o& i' e5 l% y[client]
" r6 t& P8 N! \8 Ldefault-character-set=utf8
3 E1 `7 T: J4 l) x' l# z7 b" N
3 i3 \9 J: O% f& w5 n1 j嗅mysqld$ x8 P3 ]- B) ?* Z6 d2 K
service mysqld restart
3 Y( p; m$ q4 k6 C, }" s
# q$ b+ v! X0 ^- e$ k1 m: M/ g, b' I敺航賡銝雿:
/ M5 e2 ~- }, l [* ]3 o- F; \mysql -u roor -p
$ X1 C9 i+ v" i: x1 v# W3 qSHOW VARIABLES LIKE 'validate_password%';
+ Z) p/ \% n- nSET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!
( F! o8 }" v7 `& ^2 y9 t: u( I# W* ~! [
8 ]4 I! H$ V- R" \* K' @+ K& M* Z0 B閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~
, X# h6 h# f2 k3 T" \9 `- <?
( H/ `/ L4 p) \7 T# n* u - $hostname = "x.x.x.x";
6 Y9 R- g" G2 s; f; ^2 l/ b) m( R - $database = "db_name";
3 W) V* q _5 e - $username = "user_name"; ~+ ]8 o8 V) G; Y# E) Z
- $password = "pwd";
2 B' @6 [( \9 i3 @
: g* ]& y: S( X6 ]8 I6 B% d3 o- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);- s% t9 k+ m3 B3 h! M
- mysqli_query($conn ,"SET NAMES utf8"); W2 R) @! V% o- B6 h
0 i, j1 D# U3 Q( u7 W- $sql = "select count(*) as total from " . "table_name";
6 J% j$ u, f9 ?; s - $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));
5 B Y) {1 f5 J8 ?; n8 _- @ - echo $rec['total'];
9 G" e- b3 [# _$ T, t - mysqli_close($conn);
8 U* @ d/ B( }7 B1 b1 H- T# O - ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0
3 H8 `# ~: y2 ~
" b2 q- }' K9 Y* S/ `
) S' N7 X* O: [; \酥hp 7.2.24 connect to mysql server,箇 : - PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9- g& X' A4 _9 B7 S L* q
- Stack trace:+ {% Q% a1 ^: {, z4 o/ Q
- #0 {main}, P1 C( W$ K& F4 ^2 m! P/ t0 w% Z( T: M
- thrown in /test/connectmysql8.php on line 9; A) T' K, q* j5 A
- $ m2 y/ [0 r0 u
- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
9 D( i1 n- L: N0 W& n - Stack trace:* U. [9 M1 |6 P2 B% `( |# l' t
- #0 {main}0 n7 @& E u, h g* Y! D
- thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳
# B h# I" ?. D2 p$ ~& j, t' f" r. I
. G9 b. }# V* j5 U8 e# d
[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.
, }0 @6 `4 `# e2 {' d隤芣: 砌賜批撱箄降"UTF8MB4",血⊥. m! b& y' }6 z6 y6 P5 ^
. |/ |" ^3 g7 p! V! E
(2)
! Q! [6 Z+ V/ l5 R7 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 'system>0' at line 1
0 n9 ?) w) G2 ]% f5 Q! Y* ISELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>0 y# g1 }, s5 z) V% i* [% H$ }
9 B6 s9 _0 C# A8 N5 s/ x# M3 M/ Z
(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
' b ~4 u& W% R) G; L: V+ dSELECT * 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
9 e. x- [0 y% S, i' o8 e
& N# n+ ]$ [6 q+ f撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`6 r2 k9 A( D6 }3 h
- q% L; T; E' t9 z6 S2 j蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗
. u( V' h4 E9 \$ y9 F. o撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯
" x# w S0 i4 {
0 X# }5 I; @. [蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗
3 ^3 G, u+ Q6 u, y& a, z3 ~) q( B撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯$ u8 j( }0 ?2 ?0 b
8 e; f- S1 j9 S. v2 p
憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊# ^) r3 @0 y$ B& K! d, R* \
# C# T4 j. \4 l
箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦
, [5 S8 k# l) n' P隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊0 R4 C- G( s n2 b7 ^ a) f) H3 v
Q, T% P& X: A! A
, d0 K- R4 r+ z" L3 |
6 q' c& c* F6 p% k
* O; V. g7 S2 d c l- S# d9 w3 b
|
|