(1)
) _% `8 C8 B5 O a+ _) M. fphp逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)+ \- \/ i2 g$ r8 r t- ~' L
9 T* j5 F, V" f! Q2 x6 Y# n: O3 z# T
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
2 Q0 o! T3 M4 J3 U, e' ?mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers( n% F# C3 X0 y( A e$ N3 o% Z6 H
:+ p% I. g6 `% j- C' ~: o
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
3 e$ I' r. A; q5 o* Evi /etc/my.cnf 乩:5 w8 U- N- `# g3 |) E
[mysqld]6 w9 _ X& A. {1 [& E5 D B/ H
7 {' d4 J+ @0 O9 @7 Fcharacter-set-server=utf8
1 H' X( q( D$ Q: Z6 l: Bdefault_authentication_plugin=mysql_native_password
( L$ z9 J# W5 Dvalidate_password.policy=LOW
) P: P" v+ [$ u8 _0 i- }% ?( {[mysql]
% u/ G$ Q1 o( y0 Ydefault-character-set=utf8
" e" _2 X% ] a: C' }2 w/ E0 I" V4 i, X8 P4 v
[client]
/ N% m5 D. L0 p1 Y& d0 H8 Y, E5 x( ?default-character-set=utf8
9 _* C4 I' _1 [; R/ g1 u; w4 u& J4 ]# U+ b* U. j
嗅mysqld
/ J \2 R4 z2 ]0 T7 g4 h7 N4 eservice mysqld restart" N; k6 j/ f1 u$ X# A+ O
% D6 n4 }: k6 x7 L8 M/ ^% _9 O( \
敺航賡銝雿:
; i1 C5 ^' R+ x) Kmysql -u roor -p . S8 H; k" w9 x1 P \6 J) F. {6 ]
SHOW VARIABLES LIKE 'validate_password%';0 _# D9 U% }" q/ V% u9 i
SET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!) \+ o- n. f+ g9 E* v2 l
; n6 E6 f6 o0 B- w閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~
- H3 Y# R' x1 G5 `# ^' e# O& b- <?
" u( H" e; _4 f7 D - $hostname = "x.x.x.x";2 n; y* F! i3 W; ?# u& V8 }
- $database = "db_name";
8 u; J& l& t3 _8 y+ c/ L" E; } - $username = "user_name";+ B* U. X& w& L
- $password = "pwd";2 I- z/ k: u* ^4 U# d, h
: n, M4 n5 b7 _+ R3 D% Q8 o- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);
0 F t2 |5 C' G4 n5 A; t - mysqli_query($conn ,"SET NAMES utf8");
: J8 }; j2 d0 E( s* _: t - ' }& H- G( h. S
- $sql = "select count(*) as total from " . "table_name";
9 J; e* V2 I' D* U* [* m' V - $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));- f4 w6 H7 E4 ?
- echo $rec['total'];( h* W) n* B, z( C- i+ C
- mysqli_close($conn);) {! u5 R8 l% n% |
- ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0 9 M# J# J3 F$ ]* C& }3 R3 {' R
) {7 s: U# ]" \% M; M) ]0 W# c
$ O/ F, A- K: U6 v1 Q/ Z2 f6 g# R T
酥hp 7.2.24 connect to mysql server,箇 : - PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
. k i# Q R: c' J% r0 p+ z; @ - Stack trace:& ], l/ T/ C: R- ?, o, m7 D
- #0 {main}
5 o- S! ^. z, ~9 r% M - thrown in /test/connectmysql8.php on line 9* u2 F5 z- t9 J: X; Q
# a2 Q# b4 V* i2 {- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9 h3 ^2 i M" k/ p7 D# N4 [, Q8 }; O
- Stack trace:- Z/ m5 f$ _# q& j0 C' u
- #0 {main}5 M) V- p) k1 E: f8 E
- thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳4 N! z3 ^% O( T! i
+ A6 a2 V) E8 {+ v# t$ U- s# U. M+ V+ ~5 D( _6 Q; \# |
[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.
/ v7 z4 @* a% k5 t) E0 |隤芣: 砌賜批撱箄降"UTF8MB4",血⊥8 F% {* P' s% E
4 C; i) x9 ?1 e. U, M& s X
(2)
D/ j0 d# X* G0 h7 O, R' ]/ 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 19 H- S- D( T# k# m& e/ _) M) F+ p
SELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>04 |( S, S& |+ ?; W
: M1 c4 m* f9 D2 w w(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% {; A# s: e7 O5 @% J
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 17 ^* ^ K4 r% R. q5 O
1 G4 e9 g$ K3 T7 o% t撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`
Z5 F& U& Q$ j' W/ r! V3 z. m+ K, B# Z/ M6 S: A; U0 f
蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗8 B/ H3 [( E% d6 f, A1 f* q7 D1 g
撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯
* L4 P$ R% e# T; |
4 i+ U. I8 ^& q$ j6 r1 s6 n蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗
8 `' B- h' _3 u' i1 V# P- r' H撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯: F. ` u/ X' u9 n8 B
2 U: U! Q z% C7 ^6 J
憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊* d( ?& u4 ~9 P; ?
a" C ], i! Z8 K( S! A0 @; j9 ~
箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦& S" K5 I) E1 y( J3 d' S3 Q
隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊4 p! t# k9 ]- h- q! i
: z( [) M6 T. u$ m* H3 H ?- ~3 ?/ Y
6 r& K, K1 w" |/ A: O5 P/ P
5 x$ B; E3 t# Y/ J
|
|