(1)8 g) `" M C! ^- |* E
php逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)
9 \3 k/ c7 c [8 [9 p/ W
6 O" ?* I. n5 P$ o- Imysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers1 P4 D- X' f* S
mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
' q& E8 v4 F$ c' d4 n:0 \- M# A, W3 V. w+ e, p
決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:( G3 N3 s1 r. u7 d
vi /etc/my.cnf 乩:
$ k6 R d0 ^. {# k T9 r) [[mysqld], y7 d& f8 G+ T$ P$ `* y
& t' X, s( p% l: z! P: E
character-set-server=utf8
$ ]. E9 ^; i5 X7 {9 D9 D( J2 Fdefault_authentication_plugin=mysql_native_password
" t9 g' u$ |8 v7 _' A4 Ivalidate_password.policy=LOW
' `. m0 ^' \6 W( l$ b- y1 c[mysql]
, I- V- z% N* y* H6 @default-character-set=utf8
* }* R) {; f0 c. I8 U0 C/ y
& Z* Y5 _2 A5 h4 a- n[client]. y2 v2 L! z! z* a
default-character-set=utf8" a, r- \( ]4 ~6 Q) V
( {' h, r- W6 Q( C5 U: s6 Z! d o嗅mysqld+ X! w' [: p' ~
service mysqld restart/ D& Y* P0 x5 L) O( k
4 \8 E6 A" q! ]) D( b2 l
敺航賡銝雿:
' i% \/ R+ Z/ ]6 ]' s' nmysql -u roor -p
$ r, T+ x: ? l. g) C1 sSHOW VARIABLES LIKE 'validate_password%';1 r, A$ h1 W; N, c7 g+ g
SET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!
6 s" r& [ W$ S+ \% }+ Z4 I9 a+ y7 a0 S0 W8 @5 _
閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~* i" R* t. ?* P I
- <?
- d4 i* S/ E9 Q- Z2 C3 V - $hostname = "x.x.x.x";
! x3 q3 t3 @; r) H8 k - $database = "db_name";
) b' e' {- I/ ~. I - $username = "user_name";
1 q1 k5 _1 c+ U: q7 l - $password = "pwd";
) t! a( X; ]9 L0 {; I+ r( E- j J - 1 [% u/ }! J0 ?
- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);
7 t+ f! l1 J3 _ - mysqli_query($conn ,"SET NAMES utf8");
' x( S2 b9 [9 e u# | - 4 m# }# z3 }; T' F' [4 s/ E$ B o3 M& l
- $sql = "select count(*) as total from " . "table_name";* `. c$ K2 p2 g7 J5 v
- $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));0 d* }: x* y. L, ]7 j, i
- echo $rec['total'];) B1 F9 Y$ \( A& D, c
- mysqli_close($conn);
2 m( b9 r9 R4 w6 ` - ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0 , O! H4 t1 w' O; [3 K
6 q7 x8 e# u% {' ~7 E
: l0 e* W: I3 J酥hp 7.2.24 connect to mysql server,箇 : - PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
% c" X# Y K5 k1 d - Stack trace:
: L7 B# a0 v1 s6 e - #0 {main}- v# w0 o9 P7 Z) L6 w( v- e
- thrown in /test/connectmysql8.php on line 9
, G% u$ b$ V6 h8 P
, W% @+ z1 i! `( n- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
$ |1 q8 l" T4 U/ _$ k8 [7 c - Stack trace:
0 Q. O6 j, [) ?' T8 x* c% {. a - #0 {main}$ ^8 O3 G& y/ o
- thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳
2 Q- a1 B" W8 c. h$ H; `4 f8 x6 R9 r- T$ @: x; X
: L( N% g8 Y! h$ G6 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./ ^% j6 A2 o: z1 Z, J7 _7 [
隤芣: 砌賜批撱箄降"UTF8MB4",血⊥0 r B. V: L! J& o
) z5 O; @7 Z% n% m" c2 F: p& H(2): x8 J* E# K7 W+ \$ g7 D" E' a: j7 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 'system>0' at line 13 I( }& x7 v; n" L# s- ?# m6 |
SELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>0( M {4 s9 Z1 {6 i) [1 d3 g
7 ]3 [ J% u8 ~& Z- A% 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# J2 ]* ?- X" I4 S9 {+ E
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, e" M8 M6 {* \: {' {
) ~8 H/ s: U3 Q$ P1 Y撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`/ o1 Z" ^% c' w1 H+ [1 v
% j g5 `: I7 t1 G1 i3 D$ a+ i! x$ Y蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗& U7 Q0 \$ `4 b* ~7 O3 e
撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯
5 P+ n' a. L, W1 J9 l7 P; o
) `4 G; Z3 A3 F蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗
% K" B* R: v4 k9 a+ e* p撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯
7 X- X" t4 M$ q" i/ ?" K$ e7 n$ r! J* p) p, k* w- t3 {$ l
憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊( G, l' ]( V: q
: T' G d* C$ `& ]9 r% a箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦; z; j; k8 Y5 E- o* G) S' y9 o" k# i
隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊' m- n$ Y9 f: i4 g
/ i* @' O2 F6 `0 ?$ M" @" ^0 w4 J. e7 K
7 o k9 s, S& Y. k( D' @2 Y
9 J5 O2 v* Y ]3 j: g1 X% v5 R
|
|