9 A" v, s/ C" A# ]. o+ I[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.* V$ f% P; ]) V
說明: 千萬不能照它建議用"UTF8MB4",否則無法成功啟動 7 i( c0 W3 u1 G( O" I! ] r! ]% H) t( ~& A
(2) 0 v" M- v+ W; R(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 4 F6 A, F8 V" b7 L+ j3 a3 P1 }+ sSELECT COUNT(*) FROM common_usergroup WHERE type='special' and system>0 ! a* ]5 v6 O' ` ! B8 C" F8 l4 o; X# J: O; b5 y(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 13 c/ }- t) t* s% 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 7 } u, C- v8 D ' c7 a' I6 J) x1 Y' x因為MySQL 8.0+將system和groups作為了關鍵字,所以不能直接在SQL中將system和groups這兩個詞作為數據庫、數據表、數據表字段中的任意一種使用,如果數據庫名或數據表名或數據表字段名使用了system或groups作為名字,必須使用一對反引號引用起來。寫作`system`或`groups`。! H5 B: M9 m) @. |
# U- @2 i) T) I3 C第一個錯誤需要找到Discuz!目錄中的source\class\table\table_common_usergroup.php, / A" A# n ^8 Q2 B" A將文件中所有的system全部改成`system`,保存後重新上傳到服務器的相同目錄即可。! w% n8 m+ j0 s' ?+ y
9 ^4 }9 D/ a- p+ e2 a第二個錯誤需要找到Discuz!目錄下中的source\class\table\table_forum_announcement.php,0 j! j* ]% y2 E3 g1 v
將文件中所有的groups全部改為`groups`,保存後重新上傳到服務器的相同目錄即可。* G; q' F9 d; I# i- u( a
6 P* @7 L; w$ J+ s0 W! s+ m
如果在MySQL 8+環境下安裝Discuz!,在安裝前需要給install\data\install.sql文件中沒有加引號的所有system逐一添加一對反引號保存重新上傳到服務器的相同目錄,否則也會出現SQL語法錯誤。 ; Z/ P5 S! e2 d! k/ |; Y. U0 @ 4 d0 ^/ v+ J0 [2 e9 `. V為了避免語法錯誤,在寫SQL語句時,一定要為所有的數據庫名、數據表名、數據表字段名全部添加一對反引號,像Discuz!這樣的寫法是很不妥的。 ) F( z. e5 @8 `; o! v& _: T以上參考: 升級到 MySQL 8.0+ 後Discuz! 更新緩存時出現SQL語法錯誤5 O' q' W$ w2 _8 P