(1)% u/ j- r+ \/ B
php逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)# r4 O v" m) |* V
" j% C& T' \ @2 a! \mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers a9 K/ I- x" t4 m% [ ?
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
* F- \# f$ p$ ]( t! b8 x& \0 J! t:
, M8 h( `" b( `3 |決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:8 y* L" ]) ]4 R; H
vi /etc/my.cnf 乩:8 W. h) |; `8 n$ U& y4 y7 ]
[mysqld]; u9 V% a5 ?# [6 x
I c k* L# S& _1 u& ?3 R: t ~
character-set-server=utf8! y6 v/ s( h6 P0 }) O( s
default_authentication_plugin=mysql_native_password3 \( s+ B7 x/ L- l# m* R; X
validate_password.policy=LOW
6 F+ n5 Z+ ^. [" t; j[mysql]
% ~& c4 [5 f, y& r; \7 B% Ddefault-character-set=utf8
/ z8 A# x- Q3 ?- z! Y2 H, \( {% F# `" w# L& ?6 A
[client]* l& |' P T# {. G6 A4 d+ Z! x6 W
default-character-set=utf8$ s! p' G0 C& H% j+ S' \/ J y
) `, Q6 E2 ~; C! w: I
嗅mysqld
) G2 L8 {6 V5 u' P7 x. G; `service mysqld restart
% k2 m- {" U! m- J- C
1 }% h6 W3 V! i- T敺航賡銝雿:, }$ g5 Y- T1 B1 H3 g
mysql -u roor -p
, x& S+ g7 D; F6 a- `' _0 b& y9 |SHOW VARIABLES LIKE 'validate_password%';
, f" L6 U) O! xSET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!
% o4 [2 `# l. {" X! ~+ T8 k1 C( Y: \; U5 I' n- P- N/ W# p
閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~
$ R/ n8 t- k! Q7 T, W& ~6 j- <?
* R# I3 T L' b r& l. X4 v8 g( N4 \ - $hostname = "x.x.x.x";6 e4 N8 l% I1 D. H; G% s
- $database = "db_name";" {" H- B* J0 J& ?% ] y4 i2 R! Y0 ?
- $username = "user_name";
1 P! E7 K% |7 l5 S- J6 S/ S - $password = "pwd";2 r; a0 k* Q% t0 f: y# ]
- + i4 i. G& H6 [& z5 Z* e
- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);6 g/ _6 U8 A+ Q& I6 U$ e0 Y
- mysqli_query($conn ,"SET NAMES utf8"); t) i2 K, B% u# ]4 S7 W' U, e
! x. A v4 I; |- $sql = "select count(*) as total from " . "table_name"; ^ O& N' }' B: H
- $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));0 q9 W; T, y) S+ F) _
- echo $rec['total'];
9 H2 r, d8 s4 [ - mysqli_close($conn);
& j1 r1 P9 R6 x# e$ s - ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0 2 O9 @, M8 U4 \- ~0 k7 m, [
7 ?* O' c0 P7 q! q
) f$ i8 _' i3 p r$ W( |, P酥hp 7.2.24 connect to mysql server,箇 : - PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9( [) d$ p( P! @& \/ _+ L
- Stack trace:$ n! N3 }. { t( e7 ]$ X. V! B
- #0 {main}1 Y6 b9 B4 h3 u3 t: |7 {$ B
- thrown in /test/connectmysql8.php on line 9& X$ t8 T6 D+ d/ l% X+ a
' T( k' p+ t0 t7 ~+ U! W0 y- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:91 c/ j. Z: Q6 i
- Stack trace:
7 T6 k: P6 v4 [3 y- q - #0 {main}: t8 ^- }/ l0 E; h5 T6 [- e* \1 {
- thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳8 D* v* X6 n& z4 n& ^2 X
! H. D' H" K6 w: u: m1 H
( C, V5 b3 n7 w S
[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.) @9 b$ Y, H! f
隤芣: 砌賜批撱箄降"UTF8MB4",血⊥! ~5 U2 u/ }; I$ _3 `/ W
/ w, D' W( u7 b1 Q(2)
0 h3 Z) B# H7 R. C! l9 x' F5 J(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! C" ]$ [* ^) A V) k$ O
SELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>0
4 |7 D( w& }+ ]3 R1 j" \
# ~7 m/ v9 o" f(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
) U3 \# K* |; Y6 MSELECT * 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 11 T. J6 o S. }$ y3 c
- _8 Q. [3 d( L: E6 E- V7 y5 y5 T
撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`% Q( v# O: m, w1 S) F
: K7 T ^. F0 z
蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗
i6 {7 @% e5 w3 a. |# X' G撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯9 v+ |& L& f& R) `. W& Q C; U
# y6 T/ {! i* ]2 A' q, a2 i7 g蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗
" M. N6 [7 C* r& e8 s撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯! ]% m6 W! A/ }* F# V1 E
* N# K8 r3 M1 z# B' G憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊0 A0 s1 [/ G8 g' h7 V
8 B3 W+ p' ^7 P8 C/ i
箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦( c& c, Z9 ^1 x7 f
隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊( \, l1 g9 h. a+ M4 J0 `1 l8 x( n
# F! w& [9 t: D1 u
7 ?# w6 }# A0 k
3 S( l) R5 N# [( U/ F' Q& s Q1 ~& D
" N+ |' o9 p2 D, O; G# j |
|