typecho Database Query Error

2021年12月12日 · typecho · 245次浏览
刚才发布文章出现 Database Query Error,原因是 Typecho 在初始化数据库的时候,
选用了 UTF-8 的编码,而在 MySQL 中,UTF-8 只支持最多 3 个字节,
而 emoji 是 4 个字节,所以出现该问题。如果嫌麻烦可以直接删掉 emoji 就可以成功发表了。

上传附件失败
问题:上传所有附件都显示上传失败。
解决方案:将 typecho/usr/uploads/ 文件夹权限递归修改为 777
emoij
问题:只要文章中添加了 emoij,保存文章就会显示
Database Query Error
解决方案:

1、修改数据库 charset 为 utfmd4:

alter table typecho_comments convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_contents convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_fields convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_metas convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_options convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_relationships convert to character set utf8mb4 collate utf8mb4_unicode_ci;
alter table typecho_users convert to character set utf8mb4 collate utf8mb4_unicode_ci;

2、修改 Typecho 配置文件 config.inc.php 中数据库定义参数中的 charset 为 utf8mb4

'charset' => 'utf8mb4',
开启 Typecho 的 Debug 模式
在 Typecho 配置文件 config.inc.php 中添加下面的代码:

/** 开启Debug模式 */
define("__TYPECHO_DEBUG__",true); 

在,打钱

标签:typecho 作者:南柯一梦

最后编辑于:2021-12-31 18:04

评论

  1. Crystle Hartung Crystle Hartung
    2022-06-23 13:58

    Hello, did you know that there are 241,120 internet directories in the world.

    These websites are what drive traffic to YOUR business.

    Want more traffic? Want more Sales? We can help - today.

    Your website wej.cc is listed in only 22 of these directories.

    Get more traffic for your Cocos (Keeling) Islands audience.

    Our automated system adds your website to all of the directories.

    You can find it here: getlisted.directory/wej.cc

    Act today, and we will expedite your listings and waive the processing charge!

    回复
  2. Faith Kraft Faith Kraft
    2022-05-07 00:46

    Hello, from CustomData.click we are a provider of unique databases that could help your business.

    Please visit us at CustomData.click to see if we can help you.

    Regards,
    Faith

    回复