(1)8 J3 c& P( ]; z; k P6 [/ [3 d
php逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)
( [4 x' S* q& v" c, i; Y# ?
4 a9 {3 C. A% [8 V1 N2 L- Lmysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers* n7 r4 g5 `& x6 s0 U4 D: }
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers D( K! Q+ \1 m7 w4 ~$ @4 g1 X1 b9 Z
:9 g; _6 i6 ~4 T- n4 p4 z* F
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:! R. @3 r* R/ Q& K9 [ Y2 a: b ]
vi /etc/my.cnf 乩:
1 g/ B: O( @( r% a! u# M[mysqld]
1 S0 V" H# u% r# V. f' p. X$ {6 W& l. m+ V. W
character-set-server=utf8
, @ q" m5 o$ N7 {default_authentication_plugin=mysql_native_password
% k1 Q ]! |& l3 Z3 M2 Avalidate_password.policy=LOW
# g# Z0 w% R0 z6 \; R' _8 i[mysql]; G5 `$ ~7 b: M
default-character-set=utf8* H7 p+ v) s8 L! g
4 j, y$ b; f$ c- ^. l% q[client], {9 {/ L# D: i
default-character-set=utf83 h7 Z; d# `7 s: K: ] Q: u% t4 d
0 l6 ?5 h3 Q4 N0 Y! u% t( |( i
嗅mysqld8 S8 `2 C) }- z7 i$ B ^5 v |4 N Q; W
service mysqld restart
4 V8 r, P1 t/ n! ~5 k# b1 E) h6 o8 m/ E! X5 p* Z; I
敺航賡銝雿:
) A2 [( N; [( N0 R! ~: |7 |mysql -u roor -p , T+ J" f; l0 \
SHOW VARIABLES LIKE 'validate_password%';2 s( f. d* p+ o
SET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!
/ _& }4 I) g" N0 G9 D: l3 s9 f' O a/ e0 x3 X6 Y
閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~
. S) R# P# }+ d: x- <?, c' T$ Z. k: z6 A+ a! J! H
- $hostname = "x.x.x.x";
8 `" y+ f- E7 M% X: }; S! j& {, C - $database = "db_name";
3 z7 i0 o3 q4 a' Y, K3 O- q - $username = "user_name";
- J- i( J" O- p$ q; s8 ~ - $password = "pwd";
! Y# N7 J2 y$ \/ z' @7 V+ L - 8 o' ~/ {' ^! S4 T0 i4 }
- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);9 Q; T8 c0 K5 Y% y
- mysqli_query($conn ,"SET NAMES utf8");+ }# ]# q. o; i
- - x7 \( X: b4 |' |8 J# Q
- $sql = "select count(*) as total from " . "table_name";
+ i0 e) e% a/ P% g, \/ p - $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));
1 g+ ?/ j% y! \% Y - echo $rec['total'];
; x: E9 u% d# y# X* I - mysqli_close($conn);7 h7 `6 q$ `+ Y; y, C( c
- ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0 3 e3 [6 ]) k* G4 Y8 V9 d
( F: q6 P8 K, ~2 a6 d L0 {; a+ u& @+ l9 i$ B$ z6 q6 E( K6 j
酥hp 7.2.24 connect to mysql server,箇 : - PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:90 |' d3 `. c8 O* B) r$ T$ ]
- Stack trace:, @6 o% Z$ l# Z* n4 i
- #0 {main}
0 a% k( f! B, \ - thrown in /test/connectmysql8.php on line 9
+ k6 W" k5 a' k% w - % y4 C7 E) g& J: z' _( j* d9 S
- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
; ~; L$ S0 A7 p - Stack trace:
8 S0 v& b- m& X) Z3 ` - #0 {main}! c3 n2 n. |3 D. L% Z: r: l$ A7 \
- thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳0 G: a9 K& P; @1 V
9 _: I4 l8 S# b h$ z
' P# B0 W( q7 o2 k. B* H
[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.: x: h5 ~2 ?& G. a0 K3 s
隤芣: 砌賜批撱箄降"UTF8MB4",血⊥9 Y7 M0 {/ N, J3 S
6 U" f8 Y$ ^) u3 ](2): u9 l" d0 W% M7 J7 b3 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
$ ^3 K" J: f* tSELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>0
3 {9 w7 I; Y4 k4 K% q& l
/ ^, x- U) l5 G; S" 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 'groups = '' AND starttime<=1532077291 AND (endtime>=1532077291 OR endtime=0) ORD' at line 18 P: K% t% K! J, S
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
* X3 g2 X, E: V$ r- _; a0 M4 P/ Z- d% z! V* j7 O
撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`( h( ^; F! |* I4 w( W4 E* q7 D9 \5 k
1 R8 g! C* `9 r$ K. y% @8 L
蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗
S: M- N4 q# {( [' M3 g9 {& N撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯/ [7 f2 m) _ [: {
0 J( P1 p) j# o. f2 w1 Z3 R7 s蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗- g) Q3 a3 O5 f3 |' i
撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯0 t; m5 i+ t2 J3 t
, a1 { g+ Y, I8 t+ E# U! T6 ]憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊
: ?/ n. u+ \9 U) N1 ~
, F0 i7 S' V8 S. f* L. R3 d箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦
8 H1 ]' `% \$ L( p0 `3 s% f3 R# s! Q隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊9 j3 ~9 s; e* Q( N0 p t0 Y" A9 x
# o4 [* x# J8 R5 P: o1 Y
; q$ N! K$ P1 Q/ s$ I) P
; m; ]" y3 o7 M! P' N9 y
9 d. J% N' K% Z. A" r1 f4 a3 R |
|