(1)
( x4 x" H" C6 yphp逅ysql箇2銵errors : (discuz蝬脤箇曄舫亙逅ysql航炊銵冽,芾撖思駁叮ysqlphp蝔撘靘皜祈岫)
$ S8 \; f# [0 L, e: V
9 i r. e# l9 z+ c( c7 gmysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
/ ~( D0 o0 l. I% `7 { Rmysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers, |8 Z2 V0 g; q( @) m
:
+ a: j0 @6 i, t# x+ U3 m! W1 T決ySQL 8.0.21銝哨caching_sha2_password舫隤頨思遢撽霅隞塚銝臭誑敺mysql_native_password隞亙php銝詨捆臭誑蝝php嚗銋臭誑靽格遍ySQL蝵柴 曆犖瘙箏靽格遍ySQL蝵:" ?, m' v% e* y0 v' m1 ~
vi /etc/my.cnf 乩:% Y% @7 J8 ?1 g
[mysqld]
) y9 F( }; T# ?8 m5 l/ J
2 m5 X9 _; o) V4 Y) R% G0 x8 m- kcharacter-set-server=utf8+ G! w; n# Q7 M* ^5 q6 M
default_authentication_plugin=mysql_native_password" {9 M+ ~. ~# q
validate_password.policy=LOW+ p3 O5 `* d6 x! ]
[mysql]% f( L- R2 ?7 v9 R! X
default-character-set=utf85 C& I- U5 t. s( D8 M1 V G, |
2 {( ]& V9 F2 | C+ Z$ b
[client]
; E8 h4 {3 Q3 |% Udefault-character-set=utf89 E( c( {0 K, w
6 m' s+ ?: _) D X' S
嗅mysqld
- u& b7 A% E# L1 I; Fservice mysqld restart
* E( T6 D6 \# o% ^6 U& b* Q) |: @- }/ B8 }# Q/ X7 }
敺航賡銝雿:3 K0 S7 b7 s- I5 M O
mysql -u roor -p
! v& @" N* X7 C2 ~% qSHOW VARIABLES LIKE 'validate_password%';4 {) ^* ^; D a+ z# l; x7 L3 T @" X
SET GLOBAL validate_password_policy=LOW;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '雿撖蝣';摰!!
. N& [' x4 u4 g; k( R9 k9 ~0 c6 Z: w7 ?. P1 v4 b" l
閮: mysqld,/var/log/mysql/mysqld.log蝝:閮: 臭誑撖急皰hp蝔撘隞交葫閰 ~~~% b$ D' z3 d f' _
- <?
, m# z/ t* E" Y7 x! m$ z - $hostname = "x.x.x.x";
, k& j0 C }& O* i; U# t( P - $database = "db_name";
! f3 x& ?2 k- @: z, [- D" U- z - $username = "user_name";
& X' X* g/ y) o" f" h- j5 L2 K - $password = "pwd";) N. e0 {8 |3 J
# f' v) U: @4 }1 X1 k* I/ B- $conn = mysqli_connect($hostname, $username, $password,$database) or trigger_error(mysql_error(),E_USER_ERROR);
, @+ ]. x' Q0 Z2 J - mysqli_query($conn ,"SET NAMES utf8");: p/ g6 Y, c$ H9 S- O6 u, q5 ^
- 0 ]* N# E3 j2 h5 `& h4 S5 |6 b6 O
- $sql = "select count(*) as total from " . "table_name";
* r9 {; ]& y' r - $rec = mysqli_fetch_assoc(mysqli_query( $conn,$sql));
4 B2 e9 Z5 e1 A1 x$ ?2 u* i - echo $rec['total'];! X7 M9 }4 {* e- o# x
- mysqli_close($conn);
- |; N9 g6 | E0 y& Q - ?>
銴鋆賭誨蝣摰g砍梯批捆閬蝛擃 999999999999 舐閬踝函嗅蝛 0
( K2 t: i% K! `; O0 X1 Q- T [# m: r3 ?* L, V+ e2 B; I! _. v) o% q$ u
" D# Y F( G F9 K6 X( o# M
酥hp 7.2.24 connect to mysql server,箇 : - PHP Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:95 v% b7 ~8 u2 C0 U7 ^$ N- U+ u
- Stack trace:% g _# d( b3 X' I: W7 J C7 f3 c
- #0 {main}
5 k2 H2 K" K* O1 D P - thrown in /test/connectmysql8.php on line 9
4 j9 Z' P. ^' k" Q7 @% x+ C - ! D# z- ?1 l% u# R/ u
- Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in /test/connectmysql8.php:9
& O5 ?3 k h/ d0 M3 Z0 \, k - Stack trace:
2 v. n6 g8 F! s* J* e; ^- | - #0 {main}+ D0 Z" T" b) r/ {0 [
- thrown in /test/connectmysql8.php on line 9
銴鋆賭誨蝣 舐祉訾憿,芾 yum install php-mysqlnd yum install php-mysqli 喳' q- S' n) P+ k' h# n! ?- A
8 S/ [4 i) V, b& [/ k$ R, ?
9 ~2 S* P; P/ K: A8 _ {[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.0 W! m: U, ]( ~' M D6 X
隤芣: 砌賜批撱箄降"UTF8MB4",血⊥
( g' ?5 J2 j. C! ~6 A o
" R8 P# T9 I9 c(2)
5 m9 X. @" G3 m, P) T0 N- h# t" i2 |(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
8 U2 J& s, {1 a1 w' Y9 TSELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>0* I" a' h% q; R
! ?5 P: _0 f8 e) w0 A(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! n1 G6 A7 MSELECT * 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
7 C# [2 e# p: W% [3 V' `5 F& Q! i2 C* _$ M; \
撤ySQL 8.0+撠systemgroups雿箔萄嚗隞乩賜湔亙沒QL銝剖systemgroups拙閰雿箸豢摨怒豢銵具豢銵典畾萎葉隞餅銝蝔桐蝙剁憒豢摨怠豢銵典豢銵典畾萄雿輻其systemgroups雿箏摮嚗敹雿輻其撠撘撘刻絲靘撖思`system``groups`
2 T/ n+ P1 M7 e2 E" R/ f0 g$ r4 l$ Q1 o
蝚砌航炊閬曉蚤iscuz!桅銝剔source\class\table\table_common_usergroup.php嚗
9 u. ]4 [- I K' U4 J撠隞嗡葉system券冽寞`system`嚗靽摮敺唬喳唳函詨桅喳胯) {1 w# I- g/ g
2 h7 H% A2 \- L% U/ f蝚砌航炊閬曉蚤iscuz!桅銝銝剔source\class\table\table_forum_announcement.php嚗# @4 @$ i) ^2 T- Z7 K
撠隞嗡葉groups券冽寧槁groups`嚗靽摮敺唬喳唳函詨桅喳胯1 T% S# P( X- T# c7 F5 J8 S: p1 }
* N8 _- I4 g6 \0 D3 q憒決ySQL 8+啣銝摰鋆Discuz!嚗典鋆閬蝯夷nstall\data\install.sql隞嗡葉瘝撘system銝瘛餃銝撠撘靽摮唬喳唳函詨桅嚗血銋箇鋤QL隤瘜航炊, |, j: i' ?3 q9 e
: C1 c# X) o& ]- C' [, ^7 p箔踹隤瘜航炊嚗典神SQL隤交嚗銝摰閬箸豢摨怠豢銵典豢銵典畾萄券冽溶銝撠撘嚗Discuz!璅撖急臬銝憒亦
& l! ?8 R7 e# B/ ^+ M隞乩: 蝝 MySQL 8.0+ 敺Discuz! 湔啁楨摮箇鋤QL隤瘜航炊" v% p1 I6 y6 Q
1 p5 ]. I4 F- H, a5 P
/ [" z6 ~9 ^- {
* X% f1 j1 u1 b+ N- o: W& A
8 y( I) r' x" J& x( Y- Z6 ` |
|