(1)
# i, G' x2 H7 B; g7 @+ Aphp逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)
! t8 e! b+ `( y2 f4 n
( f; m1 Q+ d \" g6 u6 k& fmysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
: w) l. o$ `5 y5 j& L5 q9 T6 Imysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers D/ ^( |4 Y5 k. ~) P& a7 ~2 h
:
+ u" P: s4 i+ F" u2 [* ]' ^決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:& A+ E& P# w5 y7 Q) s
vi /etc/my.cnf 乩:
) _# g y6 j, M6 V1 d[mysqld]' Q5 ], O1 [0 q' c$ z) L
5 k' H3 r" ~' _" b) t7 F% Rcharacter-set-server=utf8
% A/ W4 n2 T- j. u( {- Odefault_authentication_plugin=mysql_native_password: N- Q# B G% i+ c1 f+ K
validate_password.policy=LOW
- \5 |- @6 L+ f. o: N7 z[mysql]; m; n8 l' [! M; S! g
default-character-set=utf89 j" N% l0 p) o4 M' p+ \/ I; T, ^5 K
$ q3 W+ E. w! R9 `
[client]
5 T$ j+ o, P" T gdefault-character-set=utf8
7 V! M2 O$ t6 S0 h6 a; P
! c+ Y; i4 P# m0 o8 x嗅mysqld1 E. c s) B, U9 I2 Z
service mysqld restart
. ?4 P D# }: T' {" \" @$ N/ @% Q! }5 g7 Q# S
敺航賡銝雿:
+ f2 m0 u3 |) E- |" Umysql -u roor -p
4 i" ~1 }7 ~- u+ USHOW VARIABLES LIKE 'validate_password%';
Q4 G1 Z _, h( o0 \1 QSET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!
$ T0 i5 W& d- S6 A" u& G n, u# D
閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~# ?/ G! W, }1 O
- <?$ A, c+ s3 Y, B
- $hostname = "x.x.x.x";
0 h a0 S; e8 J, b: }9 X; \ - $database = "db_name";6 B$ o: c0 ~3 d9 q1 k0 o
- $username = "user_name";. H5 g% `4 M$ T( [" I
- $password = "pwd";
) u J6 j5 F' H5 O& r - 1 e. R% l/ S. ~: x. U: n! O
- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);. o: p3 S* J' E
- mysqli_query($conn ,"SET NAMES utf8");# {! ?! C/ q+ Z2 D7 C8 e
4 F" T1 O2 G- l- $sql = "select count(*) as total from " . "table_name";
% I1 g" S0 ~8 T4 J" E - $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));
& F% i0 L; t. D - echo $rec['total'];. ~+ W# C9 F; g7 M
- mysqli_close($conn);
" T; Y8 @3 b8 h" z - ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0 ! G/ ?4 E* d5 s; K0 n/ I! y
8 h, Z" D; R# n {6 A% ?! ]
: V6 n6 m1 C l" L4 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
$ G4 G3 N, g% ]% r - Stack trace:
) K/ D2 G8 X; t9 Z( Y4 p9 L! ? - #0 {main}5 N6 t) e4 j& k/ M6 i( ]
- thrown in /test/connectmysql8.php on line 9: W9 Y" I+ Z- ~4 E2 Y! X
- ' J& p/ z3 X8 X R [
- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
- X6 G4 N3 S: m+ |( r6 ~ - Stack trace:
\2 N/ n% r) ` - #0 {main}
2 A2 l2 P; ?. V# o - thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳
t' \& A2 U' K: r. [1 W: o4 L; C" z3 y- ^. E3 v
$ m* Y- e" q; U( U0 K9 ?; l4 G
[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.- L5 a3 V# R: E6 m5 g
隤芣: 砌賜批撱箄降"UTF8MB4",血⊥
2 e( |: m" _4 o3 H" e" i, p( D" T3 m+ x5 Z; [6 t4 \; T; n
(2)
2 x' K$ G4 B. V. W8 N1 D- 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 17 k1 w" q4 @/ k* U
SELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>0
% ~! e( T3 J$ i
$ s) w y+ z! 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 'groups = '' AND starttime<=1532077291 AND (endtime>=1532077291 OR endtime=0) ORD' at line 15 C6 q% t- ]8 B2 }# j$ b
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 19 l r' N! M+ F- b3 k. B! R8 d
: j: U! r& ^6 s/ O: n+ F5 i
撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`
p% R" A- a: Q# _* x P
* B, ~. M. i) q# ]( ~7 o3 Z蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗
1 W! P) k5 ~: v撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯
6 k% @4 X, H6 |# u' [3 Z* J% j! s' W# `
蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗0 I1 j- i. U4 R; _
撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯4 s3 \5 ]0 \. p6 i# o
+ F f. K$ W" Z+ t: f6 t憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊6 i! H4 c) R S7 Y! h9 V9 G) C3 f
: O, V. M1 ?- C% \3 c' ]: r1 d+ V" Y
箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦
: c9 j5 `( w7 m/ G B% H) j$ w隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊: }& s8 ]0 |( S: n8 G; ~2 {5 t
+ v }2 O8 B5 r" J4 z- \
* w4 z1 _# ~ U* V, o2 |5 `6 o$ [( ^- s
2 _. z, k& k* Q- u- e |
|