(1)
2 r, {1 h8 Q# }& }php逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)5 I5 T0 t q4 y8 t8 z8 Z. u
3 O) M3 h( r* Q* k I4 e' imysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers0 L) S% Y& }; U6 R0 b
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
5 {+ x8 ]& g- m5 m8 R0 \:
7 k/ B! t- J) K決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:
* X6 Q' ]; l" n8 b! g. X' |! svi /etc/my.cnf 乩:
6 |/ a$ ?; p8 `( Q. f[mysqld]. ~8 |* f4 }9 s
# L; K8 r% H4 `
character-set-server=utf8( ~% |$ t- m! f; I9 F( m* ] W2 J
default_authentication_plugin=mysql_native_password
. ]' J, G0 ` cvalidate_password.policy=LOW
, S$ S( V$ n& R/ C" E[mysql]
; C( C& u) c1 z* o) p( i) adefault-character-set=utf88 j% [9 ?+ _0 {% `
9 \! p. z, Y+ _# Z5 j: _[client]& V& ]# D. Q+ k) d/ O, T
default-character-set=utf8: H/ h5 P9 M# N& v L
) N: Q, D% n! D, a7 y5 ]5 s! i
嗅mysqld' M9 d. U6 H& G% E
service mysqld restart! s8 V* u2 j& ?6 n& m9 |: m3 r& |3 x: {
& S' z+ L5 B2 j# O$ X K. n- k
敺航賡銝雿:6 V7 T; N+ I1 B _+ h4 C' x
mysql -u roor -p 8 J6 E# h4 H1 U* Y
SHOW VARIABLES LIKE 'validate_password%';1 }$ G. |( q, a. j0 R% M% e
SET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!
& \; f% i6 d- S( _2 A* U
3 K2 M% t, N# J& a7 K# z% e) P0 G閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~- _' L8 {* a8 @' P+ f( k
- <?% R9 r9 t" Z$ x( y7 V6 ~! O$ Z; p9 z
- $hostname = "x.x.x.x";
0 t5 r2 G. W! } - $database = "db_name";5 y9 P7 D& I! H% K
- $username = "user_name";
7 ~' U% C+ E( V) G) A" b$ ~0 r - $password = "pwd";* E$ V. _0 {+ M/ l, G+ x O
- i( |0 w8 A* n) n4 c3 I- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);3 V g. z# }# x6 n- E% Y$ D
- mysqli_query($conn ,"SET NAMES utf8");" h& m3 J, v; M; s$ M/ E; E6 x
5 j8 ?6 b! j; m& x) {- $sql = "select count(*) as total from " . "table_name";. o9 [0 b, g1 I a
- $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));
" C- j% B& w# q6 z/ t& A - echo $rec['total'];
* y0 @8 M4 O- F( g6 V - mysqli_close($conn);
1 ?0 I9 [4 b" M. |$ t2 s4 @& O - ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0 8 ^! X$ c7 ]: @; c
$ b4 `' T f( h/ J$ Y0 Y0 ^/ R: J6 Q. I, W8 t) m& {# v* 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% E" [' I6 U1 S/ w. |' E
- Stack trace:
' l1 \) S$ _4 \. z$ l# U7 h - #0 {main}7 [- d' l3 h* V# q& g
- thrown in /test/connectmysql8.php on line 95 x6 Y5 w* p4 a: J, f9 D5 H% a
: w' U O4 E* Y, L- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
7 l' P( Z! f3 {$ ~ - Stack trace:
+ V1 Q8 {- Y4 V$ G& B. h. K3 x2 n - #0 {main}) R J5 R' c' \/ G8 d0 F$ K* C
- thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳
+ u o. k' W$ ]: v; }& F
: ]/ P$ X. U7 F8 ^, @+ X' m% ^2 ~1 v {" q4 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.
( H ^4 s" i- @, i隤芣: 砌賜批撱箄降"UTF8MB4",血⊥
2 Y( ^# _! Z" c" k9 G( g
2 j3 g- B& W8 w2 ~8 \' c(2)
# b. U2 M X$ }' E- V6 O1 L2 c; P(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
9 v# h: i3 m# `1 C$ o6 W/ TSELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>0$ ~+ n" `4 W! X% h1 ]1 F* r' V! i
1 L' O5 [$ m! |& @
(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
/ n- O [) Z4 Q" c: T% ~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" j2 ^2 f: O) R8 I. ~8 n4 q" Z0 o; m
7 r9 d5 s8 O: E3 N' i
撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`- d2 Q4 m- d, l u! ^" A5 I
; h. P2 _0 l3 J
蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗7 T2 s* X( b+ O t% N2 v
撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯
2 g% J7 ^$ f2 V; V( A# F
: H" R8 k3 i7 J. S蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗
% {/ n) r. Q$ o" Y( q撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯
3 @+ J9 X% z1 v& I, d/ y
4 F% K" f- o ^9 L/ G4 D1 V0 F憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊& ^2 y$ U# `) v4 J
9 j* k$ N( V3 K P$ B- |
箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦
/ g( K+ |7 w- T4 i3 O+ m隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊5 l8 O1 o1 V; e6 ]( U' d, e! T/ V( m
/ G* }. m, c9 D2 f F& F4 q
; e" D! f/ i* d& E3 {
* @$ D7 S% Y$ w5 n. _
8 \# O. v/ p: B |
|