(1)
! ~7 a$ f* y0 K0 ophp逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)
6 L1 @6 _ ?5 f6 V! z! ?
) X E, p3 E/ m& |mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers' W9 h7 n& q7 k, a$ [+ K" z
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
# J6 }, V7 r# O8 z2 Q* A K4 W3 v:
5 t" q" ~: _" o7 W) ?9 g |* S# v決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:- y9 z+ H; A* m7 X
vi /etc/my.cnf 乩:+ u2 s: {0 ?$ J
[mysqld]
$ R( C# p( Q- s2 }
" q; F& [, c `character-set-server=utf8
6 k# o- m) a+ w+ Adefault_authentication_plugin=mysql_native_password5 p# U! F4 Y6 `( ~
validate_password.policy=LOW
$ m0 a6 D% B( N; K$ U7 ~) j% _& q[mysql]
/ t8 F A. t6 @default-character-set=utf8
/ O7 P- ~* C/ b( P: H! ?
& x9 S2 C/ E* L7 B1 M* v. ^[client]$ e4 w8 e J& ?' A! F) f9 x" C
default-character-set=utf8
6 U: X, x; U: c) A R! J) D8 h" [4 \5 w1 L5 J7 N
嗅mysqld; D6 H1 `! u. f, d1 v
service mysqld restart0 G' I2 _. w9 ^- ^9 S* m, S2 h
" T3 z( d1 D! H! p5 M7 r敺航賡銝雿:
4 |6 V( e$ v: V) E8 b* Gmysql -u roor -p & D$ Y! X9 q: O9 h/ y- l1 N4 x
SHOW VARIABLES LIKE 'validate_password%';2 C0 V. k& o# O7 U1 y
SET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!
! J( b" G! r+ O# Y6 `8 U. e6 e+ j% S/ z d6 l. X$ J$ ^
閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~
8 S7 ~4 x9 T( Q+ b8 J4 R- <?
; n2 [4 y8 v8 R* B- {4 _ - $hostname = "x.x.x.x";" a& e1 }* j- @: _6 P8 |
- $database = "db_name";( d, t: _! s, }" m3 Z
- $username = "user_name";
/ O, _7 V, S# m5 K - $password = "pwd";
+ k" M$ [" n/ e/ \ - # \5 D! i+ {9 [7 O/ M9 k% _ D
- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);
, `9 O! U4 U0 Q; C! d- M. y, U - mysqli_query($conn ,"SET NAMES utf8");
% R& \' @2 u1 j' G - 9 M8 E$ p/ Z& o% d- Q0 X
- $sql = "select count(*) as total from " . "table_name";! _! `$ T+ b- ?" H
- $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));
; f) ^1 ` y4 A- i3 ^ - echo $rec['total'];0 ~1 ], C4 O! e- }6 `" q, P% P3 b
- mysqli_close($conn);: \5 x* t4 @# E- [
- ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0
( z" U+ m8 I% r3 S8 ]) i1 j; ^
( M& S4 K% b! Y7 p5 R
. R/ C: A% m1 J3 C* a9 o 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# T$ h: ?- G+ w# e0 |( W
- Stack trace:+ Q+ u1 u7 v, L! Q% {! x
- #0 {main}9 }9 O$ c* b) c
- thrown in /test/connectmysql8.php on line 9! H4 D: n; O( ^5 U( c/ y
- 8 e9 c6 J. s2 ^
- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
* @ U8 M( N* R% u' L1 w - Stack trace:
+ G3 r( R) q+ |2 q" [) h4 }8 | - #0 {main}
$ g6 t0 z$ N, ^9 x - thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳
) z) _. l( D; K7 C
" q. a. D. Z$ S9 N" o, H7 { Z5 o
' f9 J7 ^& r6 }2 @* b[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.' i0 P* E2 q6 }9 T! Q* ?
隤芣: 砌賜批撱箄降"UTF8MB4",血⊥
! e/ f/ J! v$ Z0 }5 s! o
7 u4 }- F; x$ i O6 [6 d( R, \(2)
3 W% b; X1 {7 j7 |(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( T5 B1 {8 \% R! {0 a3 ]
SELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>06 [6 T! a6 }8 V% G( I
+ z; j9 j3 e) a3 O6 |2 ^: ~(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( c+ Q5 X7 D2 a! M
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) @$ K- y3 { z# o p4 T
: K! D- X8 q- _/ A3 U
撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`
" J5 L5 ^+ {; G& ]9 V; E. u& x8 ` O6 T& h: ?7 D
蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗
& W& S! {( g' y# W撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯
0 @# f& g' M+ C8 {" O6 P8 o+ y. \1 Y7 A+ Q/ k: j& K
蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗
' l3 z( I7 _ V: i: l1 t" u撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯
c6 v* Z0 l8 z; n" x/ s) W1 S2 a2 W6 F% B: @
憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊
p0 L3 N, y( V2 P" u' A0 H5 y
0 m6 o# ] \; p4 v箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦
$ ^+ B5 k, H( i: G8 n# A隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊1 Y8 q' v% f. t1 W9 s
0 P2 T8 ~4 X+ }/ q7 H8 w+ }5 [1 P; x$ Z) l/ J
) P6 J! G9 k8 R3 u V
3 K$ |) ] U# D, ^0 r: K
|
|