(1); q% }; |# I1 B/ F
php逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)
1 \9 U" i% ?5 R& V9 p' S2 j# L" G+ j( `: G8 c6 [1 M- H" R
mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers6 W: o7 a/ h3 @2 b
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers6 q6 M1 C& k/ Q9 O
:
; U2 I Y) x1 W* G- j決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
4 Z5 r9 \0 |# m1 dvi /etc/my.cnf 乩:# u) U) l/ r0 U" g& O% S
[mysqld]
- h3 j8 s# f( [6 n% K& n+ A$ |! R- W# J) `. D
character-set-server=utf8
! s% b% r( T2 `' w; |( ]default_authentication_plugin=mysql_native_password
% |" W* k& O, U$ f7 \% x7 m1 bvalidate_password.policy=LOW
/ E8 a% Z" q# L2 J c[mysql]
4 G. f; }+ c9 o; U jdefault-character-set=utf8
# e2 Y0 E' e% h6 q. P2 J' G$ U$ @! B- Y! J( y& A) X, b2 i
[client]
$ x ?7 j' q. b4 {( Z$ ?default-character-set=utf8
7 u% [3 |3 `' O7 ^
4 t* z4 z. L: A$ J嗅mysqld
; c. J/ c7 Q5 u+ E4 m! l! g% y0 U Y0 ^+ qservice mysqld restart
3 ~' v8 }7 ]5 q. P
- q1 {+ Q5 p# i/ j @6 r敺航賡銝雿:
4 p0 D+ a) ^. n) q; ~mysql -u roor -p
5 R' o: t8 e( w4 XSHOW VARIABLES LIKE 'validate_password%';
; S8 R% k/ {8 J, N, \# M9 Z2 _2 GSET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!
- Q8 `0 F" N' F" W8 l C
) P( x6 Z) s* q$ k w閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~
# v+ s/ D. K9 f$ b8 P9 d- <?
- e* A6 L) z: ?4 U - $hostname = "x.x.x.x";% @$ g+ @1 u; ^" L) B! p2 N5 A
- $database = "db_name";3 `& E3 \" m C, \0 f! G+ i
- $username = "user_name";; J- l! w1 }7 r1 F2 W& r3 _
- $password = "pwd";
: n4 J1 c( v+ d d7 c1 S) p
4 V- k4 Z- K, t- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);
% F$ A2 w. O5 i( |0 x# U - mysqli_query($conn ,"SET NAMES utf8");
) `: l- H5 l- H/ z# s
% t' {* u, m+ O! ~- $sql = "select count(*) as total from " . "table_name";
1 W+ W: Z# t% b - $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));* e. _' m- c+ w" G1 D
- echo $rec['total'];
1 E6 z! f; R* e1 H8 {& Z6 V8 H - mysqli_close($conn);! X- Y8 S9 U' [: Z
- ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0
: j N5 _5 }$ m K: O0 r. @
: M5 \) w) L2 v
% o5 u6 g+ { V [' X2 _$ F, l酥hp 7.2.24 connect to mysql server,箇 : - PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
u% \2 I) X( d$ I# d2 r2 r - Stack trace:
0 g8 y. R* w1 S7 g1 n" } - #0 {main}
; A) K4 c, ]4 n! y( e - thrown in /test/connectmysql8.php on line 9
9 b! O; W+ h* p: O; ?+ j, D - 5 K, m. p- ]1 {7 }7 s. x: e7 O
- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
5 Z3 L# X* Q! A' f1 N. j6 V - Stack trace:/ n. E* p# h9 E1 o# K+ {4 _
- #0 {main}
s! O$ a! Z$ C* D; ~ - thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳0 I5 E5 Z. \3 q$ [
( a0 K4 f" O `7 J* M. r
* z5 C. t) w& a7 x$ n% `[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.
' {# r4 A, k! g+ G6 r隤芣: 砌賜批撱箄降"UTF8MB4",血⊥
! s+ G. ^5 v8 I5 U: ^" x4 \4 e) Z8 Z
/ ^3 a& o* @6 d/ e" ?# M4 K: @7 g(2)
1 V7 c; g( t: L9 F; k: 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 'system>0' at line 1% T h0 W8 L* j7 T- Y9 X
SELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>02 S. ?- ]1 s+ }1 r6 F4 Q
& ^; L$ J) p6 `8 T
(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
' [( f8 p9 d2 ~0 A1 A& ^' b. qSELECT * 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! ?; `' j1 N) `2 ?, Q
m; W2 i8 Y( R8 M
撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`9 ~- C- s3 ]' Z/ a- n' {8 Z1 X
- @$ N; n6 v% U3 W* w( m# E
蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗4 W1 M, r- L& A+ u6 S
撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯, A# B% b: ~/ z: c
6 \1 Y9 g/ G; D. ~% I$ G" _4 _0 r蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗! x" C+ `, D$ R- ]' Q
撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯* ?9 `% g: g |- ~
! ?2 Y- e4 X, G5 ]' p
憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊
7 d" a- I2 t, n4 }+ ]$ M5 a# q+ T K ^5 @ [' R v% k
箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦7 b8 w8 c# S. d6 `" C
隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊' s3 {/ r( B: t& M! u% v
0 L! F# b# J4 n' |$ h% g$ K
5 V5 g* e5 n4 Q4 {8 a8 _
" {# b5 s6 ^5 v. M, l
: {, q% R T7 U" X" [5 F |
|