(1)" I! s p. R, B2 A0 Z; X7 ~' p0 I
php逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)( b- w6 o# Q8 d1 A
* `9 m) X+ i4 O; s! c7 g. }! @6 qmysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
! X$ }3 _4 h8 a5 mmysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
; J. A1 [ ^- q1 [* j:
& w, |1 R2 ^2 r0 x決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:, a4 k& h6 r+ o9 z9 L/ i3 |
vi /etc/my.cnf 乩:5 \5 o' o. f- F( Q
[mysqld]
8 a& g' Q* |* q* [ f/ Y% c: b2 V/ u- U T
character-set-server=utf8
# O+ F$ S! A- Jdefault_authentication_plugin=mysql_native_password
) B. d6 ]5 `" i& F3 A. @* M: u0 cvalidate_password.policy=LOW' w4 ]0 H0 c; j) U3 p* }! q& u- F
[mysql]% K3 s; ]$ k, f* X
default-character-set=utf8
7 O4 X2 D, s: k8 G5 J6 [8 V
2 i$ M K6 u+ A. g# R- J0 l; |[client]* k* g4 l, U% G* V U4 C
default-character-set=utf8
* P3 c2 j4 H: y3 k% m5 T1 a9 V, ]' a; Z6 y/ n1 w7 J
嗅mysqld
+ N M$ ]) `! E0 U+ iservice mysqld restart
q5 w1 a. q5 y+ D7 _; P/ d9 T
# o: Y& k5 f4 ?, k4 h: f4 I# S敺航賡銝雿:; Q0 ~0 g J4 \7 ]! m
mysql -u roor -p
) {3 A' _6 h) ~8 e" h H, aSHOW VARIABLES LIKE 'validate_password%';
# e o$ \. j0 |8 Z. oSET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!: f2 F0 `6 C$ I C5 U1 h! h
$ Z5 u5 K$ j! f+ R" X' \
閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~
& h0 P: d4 P: U Y p3 |3 @- <?
" k# P2 \" _5 m/ _9 H - $hostname = "x.x.x.x";9 \( k0 `' X' B, s# y2 [
- $database = "db_name";
. ]! ]" u: E( b1 K - $username = "user_name";1 m9 u" Y+ G6 t! ?6 T3 y# F1 {. |
- $password = "pwd";
7 \4 P/ R# A" {
# N& b8 X3 ~, e* i8 y) M) f L8 g- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);
1 P6 {. \1 ~) C+ X* K - mysqli_query($conn ,"SET NAMES utf8");
, [/ G5 {4 K, o: Y - 3 V( E; D8 N2 g2 C, C
- $sql = "select count(*) as total from " . "table_name";
* s) E. [ L* C( u+ m m; I; J - $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));2 a) P6 j1 O, n/ u. G
- echo $rec['total'];
, C G7 u3 u0 i4 v! \( [$ A - mysqli_close($conn);
. G1 p' b) A P, P. q& f( \ - ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0
+ I; t+ { N2 i/ b
6 ]: R- q7 N" f3 ]5 M) b) p' Z+ j% y) d9 w, u
酥hp 7.2.24 connect to mysql server,箇 : - PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9- R, P7 q) |! ^$ m2 \
- Stack trace:
5 g' N) s" \- K - #0 {main}
( c' A1 u. O- D2 J6 G( u. @1 C - thrown in /test/connectmysql8.php on line 92 d* n, p5 |2 d; v8 n5 p$ I% \: {9 B
7 ?. |" q3 x v+ o. N/ U6 e- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
5 T* a; z1 n. Q' Q& t- _ - Stack trace:. O/ B; J$ _6 v' T( Q
- #0 {main}
2 N* d3 ^0 a& P; ] - thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳
0 c2 p- W# z9 g' P x' } X+ C* O W/ D) O8 b P1 `' k5 L% t0 e
: G1 U( Z4 p$ H9 i' b5 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.
5 C, S$ P$ D) X9 H+ H; b, l' r0 V1 J隤芣: 砌賜批撱箄降"UTF8MB4",血⊥
, k) t0 s1 Y# l! H4 x* m- U' _* L% @0 a5 h3 z' n) D# |
(2)1 |' C2 P. ?( R! W# W: E
(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
7 n1 P+ Y9 L% G, `SELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>0) |$ E. N% t: I- Q, w8 ~
2 ~) @8 K5 \4 k% i3 Q) a/ 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
( w- q% @$ s+ y A" [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/ `2 _, D8 T- E+ [5 Z( b
' p" o' e& U) B+ @+ {8 G! L
撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`
0 \6 |; J h0 L1 L9 S0 ]0 _& d* M0 f$ m
蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗; |2 W! p5 r. U' I3 s
撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯
2 F w6 n6 E( h( @" ~9 i* a8 L0 n T1 X: p7 y5 a& B0 t/ [2 O
蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗
4 S5 [& w" k A) Y+ K* E! ?% `0 p撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯
$ c- y x- H7 y4 W( d: r- ?7 G; h- }; o' q K
憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊- @: T/ ^# u2 Z) q" K3 ]7 N3 X
# P5 }; P" T# y& s$ C- m0 g% @2 }箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦- {# B q+ {, z0 F* n" v8 p
隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊
0 P8 x- p! Y6 x& ^
9 {$ b7 o9 O9 d3 e* K5 A3 |% M
5 u) u$ L( t' h% H; i3 {
, P$ R$ N1 d8 A! @' L8 J1 Y, [$ `0 O) ?3 |5 C, V9 `4 F7 t
|
|