(1)
! e; w8 S4 G/ t* l0 w. b: {php逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)
& o& Z7 B6 ^' D# Z$ f
* H* d" s6 J$ \" U$ |" |* tmysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers; H' O) T f; ]. Y( f6 R# _
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
: Y$ w% Z% d& ^:" \* s4 D! ?) h
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:1 j5 }% ]% Z2 C0 c, S
vi /etc/my.cnf 乩:, V6 x+ j& C* ^: L6 M/ P* }
[mysqld] Q% p# a3 d- V1 Y- R7 r0 x; e
! c% b: B& x# n3 }0 s! pcharacter-set-server=utf8
6 p# U8 W3 m; u% Fdefault_authentication_plugin=mysql_native_password5 j+ g( l6 P5 c- d* L$ {
validate_password.policy=LOW
% m* V* b$ X, k6 ?[mysql]
x* c: f* J' ^6 mdefault-character-set=utf8
`: t" s5 y( ~4 u1 O
* `' ^) Z' v3 j1 [[client]
5 @* H: ~ e6 idefault-character-set=utf8. A X8 Y! K) J% g7 l9 }, B+ T3 e2 ?
f, A P. L. ?1 z; @嗅mysqld$ u8 q. C9 I; t0 f s
service mysqld restart h. P( t& \3 G, n Y/ P8 z' `
3 B9 s/ _# h) _8 h8 M: r
敺航賡銝雿:
) \, N4 }- I: K- [$ D# D* mmysql -u roor -p
' @2 {6 H5 @) k5 J' f+ nSHOW VARIABLES LIKE 'validate_password%';5 ^2 D. x; e' K* s
SET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!; L/ \# ?2 N/ R% n
4 |$ N* y4 k2 i; m: A* F6 v閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~
7 O9 s& u; Z" g+ @) j- <?7 p3 b! r! e( s* m% Y! r
- $hostname = "x.x.x.x"; {% A7 Q& _6 ?% ^" r: i
- $database = "db_name";- S- h- d1 F0 @! t2 B
- $username = "user_name";
9 y- a$ }! {* N) D& g; V - $password = "pwd";
! }! W) z( r5 W+ r - ) `# F9 O. S/ V+ m9 |
- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);
" D( h7 F% z4 `! w0 P; T# T - mysqli_query($conn ,"SET NAMES utf8");
- i% c3 z$ q* v2 d- l/ n5 o - / a) d5 H$ y& h5 a# t
- $sql = "select count(*) as total from " . "table_name";
# X! k6 o$ E+ l" m$ ?$ x7 U! ^ - $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));
( @2 V* C" n$ Z2 P7 r7 C( ~) g - echo $rec['total'];
4 A( e1 P6 ^1 K - mysqli_close($conn);* `- [2 ?8 o, H8 p7 \
- ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0
$ ^' m# D7 v! {4 v) F8 g" I8 L( }" x
) s% Z* k' O8 z$ G' s2 `! o2 u
酥hp 7.2.24 connect to mysql server,箇 : - PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:96 N9 ]* T- b0 I) j5 L
- Stack trace:
$ J8 K1 M$ e. y" s* Z - #0 {main}
4 Z0 F3 g0 _4 {5 `5 K - thrown in /test/connectmysql8.php on line 9$ _: x u2 `2 C$ ^, u- j
% t$ r2 {3 ~5 p. y- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
) D4 W0 b D' _ - Stack trace:
& G+ V: b- A. J* ]# e - #0 {main}: F/ S0 P8 u" x. h' i% t
- thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳, ^9 i0 D! I3 ^1 S) J; u2 F5 l
3 Q7 Z: W* O2 x0 A4 y
$ {8 `# r- g. _0 q' d1 x
[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.
, e% e, K' n/ j8 l隤芣: 砌賜批撱箄降"UTF8MB4",血⊥
& |3 M! J) t2 H: Q
; O% c+ Q5 k' ]. L(2)* D$ _0 g; i" f3 ~$ b
(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
( u7 s( \* e# O8 ISELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>09 w9 A7 x# O" g3 C) P) } U! X" Z- v
+ d ]; i1 a* [( w7 i; u' ^
(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
$ ]7 U/ ? s- G R1 xSELECT * 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' X7 r$ G* S, u# e7 I0 h+ G
& C' g) X- N& ^; f撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`
$ c/ Y% Q+ N7 \6 _" {6 ]/ [" n1 ^) [7 Q8 _
蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗
. F8 g* [2 B8 B7 F撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯
) D8 J5 Y% ~1 O4 x8 N1 d
- _& j; Q# B: R蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗# [% A+ P p q: w- K8 g4 I; ^3 }
撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯; Y. U/ K6 x; [1 n! |& F- ?5 y- ]
2 L% O% P5 p4 W! J憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊" C1 d) A! F9 k% M* i
. n1 @- b! t3 N9 d箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦
" z8 K( g/ o- F( _' J1 M- O9 ^$ Z6 s隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊
1 D3 e8 W; P* |8 Q3 d9 G- P
& C; x! o7 u; f* z& {6 Q2 y' w7 q# ^# L9 L+ w3 Q& w9 ~
8 F9 o1 a" n# G4 ?
5 w" ~ y. h& w5 k; Z1 ?' L% Y
|
|