Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 伺服器技術 >> 關於伺服器

Discuz! database_errno_1115 錯誤快速修復:設定 MySQL 字符集為 latin1

編輯:關於伺服器

錯誤現象

安裝或運行 Discuz! 等 PHP 程式時出現 database_errno_1115,通常伴隨「Character set 'utf8' is not a compiled character set」或類似字符集不支援提示。

根因

程式設定檔 config.inc.php 中 $dbcharset 留空,程式嘗試依論壇字符集自動推導,但 MySQL 伺服器編譯時未包含該字符集(常見於精簡版 MySQL 或舊版本)。

修復步驟

  1. 編輯 config.inc.php
  2. 找到:$dbcharset = '';
  3. 修改為:$dbcharset = 'latin1';
  4. 儲存,重新整理頁面

原理解析

  • latin1 (ISO-8859-1) 是 MySQL 內建預設字符集,所有版本必定支援
  • 資料實際儲存仍為原始位元組,不影響中文顯示(前提是前後端編碼一致)
  • 若需完整 Unicode 支援,請升級 MySQL 至 5.5+ 並使用 utf8mb4

適用場景

  • 舊版 MySQL 4.0/4.1/5.0 精簡編譯
  • 虛擬主機無法控制 MySQL 編譯參數
  • 緊急修復上線,後續再規劃字符集遷移
Copyright © Windows教程網 All Rights Reserved