{"id":1625,"date":"2024-12-05T12:12:39","date_gmt":"2024-12-05T04:12:39","guid":{"rendered":"https:\/\/thereisno.top\/?p=1625"},"modified":"2024-12-05T15:32:30","modified_gmt":"2024-12-05T07:32:30","slug":"gitea%e5%8d%87%e7%ba%a7%e9%94%99%e8%a7%a3%e5%86%b3","status":"publish","type":"post","link":"https:\/\/thereisno.top\/?p=1625","title":{"rendered":"gitea\u5347\u7ea7\u540e\u62a5\u9519\u89e3\u51b3"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5f53\u524d\u7248\u672cgitea 1.8 \u7531\u4e8e\u4e0d\u652f\u6301katex\uff0c\u51b3\u5b9a\u5347\u7ea7\u5230gitea1.24\u3002\u4e0d\u8fc7\u5347\u7ea7\u540e\uff0c\u6253\u5f00\u7f51\u9875\u70b9\u51fb\u9996\u9875\u5185\u5bb9\u62a5500\u9519\u8bef\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u9519\u8bef\u63d0\u793a\u4e3a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u53d1\u751f\u4e86\u4e00\u4e2a\u9519\u8bef\uff1b\nSyncRepoBranches, Error 1366 (22007):Incorrect string value: '\\xE8\\xA7\\xA3\\xE5\\x86\\xB3...' for column `dbnamo`. `branch` `commit_message` at row 1<\/code><\/pre>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\">\u770b\u5230\\x\u6837\u7684\u5b57\u7b26\uff0c\u7b2c\u4e00\u53cd\u5e94\u662f\u5b57\u7b26\u7f16\u7801\u7684\u95ee\u9898\uff0c\u9519\u8bef\u4fe1\u606f\u63d0\u5230\u8868branch\u00a0\u7684\u5b57\u6bb5commit_message\uff0c\u521d\u6b65\u5224\u65ad\u662f\u8be5\u8868\u7684\u5b57\u7b26\u96c6\u6709\u95ee\u9898\uff0c\u4fee\u6539\u5b57\u7b26\u96c6\u5373\u53ef\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u67e5\u770bgitea<a href=\"https:\/\/docs.gitea.com\/zh-cn\/installation\/database-prep\">\u5b98\u65b9\u6587\u6863<\/a>\uff0c\u67e5\u770b\u5b57\u7b26\u96c6\u8981\u6c42\u5982\u4e0b\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u4f7f\u7528 UTF-8 \u5b57\u7b26\u96c6\u548c\u5927\u5c0f\u5199\u654f\u611f\u7684\u6392\u5e8f\u89c4\u5219\u521b\u5efa\u6570\u636e\u5e93\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>utf8mb4_bin<\/code>&nbsp;\u662f MySQL\/MariaDB \u7684\u901a\u7528\u6392\u5e8f\u89c4\u5219\u3002 Gitea \u542f\u52a8\u540e\u4f1a\u5c1d\u8bd5\u628a\u6570\u636e\u5e93\u4fee\u6539\u4e3a\u66f4\u5408\u9002\u7684\u5b57\u7b26\u96c6 (<code>utf8mb4_0900_as_cs<\/code>&nbsp;\u6216\u8005&nbsp;<code>uca1400_as_cs<\/code>) \u5e76\u5728\u53ef\u80fd\u7684\u60c5\u51b5\u4e0b\u66f4\u6539\u6570\u636e\u5e93\u3002 \u5982\u679c\u4f60\u60f3\u6307\u5b9a\u81ea\u5df1\u7684\u5b57\u7b26\u96c6\u89c4\u5219\uff0c\u53ef\u4ee5\u5728&nbsp;<code>app.ini<\/code>&nbsp;\u4e2d\u8bbe\u7f6e&nbsp;<code>[database].CHARSET_COLLATION<\/code>\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin';<\/code><\/pre>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\n2\u3001\u67e5\u770b\u548c\u4fee\u6539\u6570\u636e\u5e93\u7f16\u7801<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>show variables like '%char%';\n+--------------------------+----------------------------+\n| Variable_name            | Value                      |\n+--------------------------+----------------------------+\n| character_set_client     | utf8mb4                    |\n| character_set_connection | utf8mb4                    |\n| character_set_database   | latin1                     |\n| character_set_filesystem | binary                     |\n| character_set_results    | utf8mb4                    |\n| character_set_server     | utf8mb4                    |\n| character_set_system     | utf8                       |\n| character_sets_dir       | \/usr\/share\/mysql\/charsets\/ |\n+--------------------------+----------------------------+\n\u6570\u636e\u5e93\u5b57\u7b26\u96c6\u5e94\u8be5\u6b63\u5e38\uff0c\u68c0\u67e5\u4e00\u4e0b\u62a5\u9519\u7684branch\u8868\u7f16\u7801\u3002\nshow full columns from branch;\n+----------------+--------------+-------------------+------+-----+---------+----------------+---------------------------------+---------+\n| Field          | Type         | Collation         | Null | Key | Default | Extra          | Privileges                      | Comment |\n+----------------+--------------+-------------------+------+-----+---------+----------------+---------------------------------+---------+\n| id             | bigint(20)   | NULL              | NO   | PRI | NULL    | auto_increment | select,insert,update,references |         |\n| repo_id        | bigint(20)   | NULL              | YES  | MUL | NULL    |                | select,insert,update,references |         |\n| name           | varchar(255) | latin1_swedish_ci | NO   |     | NULL    |                | select,insert,update,references |         |\n| commit_id      | varchar(255) | latin1_swedish_ci | YES  |     | NULL    |                | select,insert,update,references |         |\n| commit_message | text         | latin1_swedish_ci | YES  |     | NULL    |                | select,insert,update,references |         |\n| pusher_id      | bigint(20)   | NULL              | YES  |     | NULL    |                | select,insert,update,references |         |\n| is_deleted     | tinyint(1)   | NULL              | YES  | MUL | NULL    |                | select,insert,update,references |         |\n| deleted_by_id  | bigint(20)   | NULL              | YES  |     | NULL    |                | select,insert,update,references |         |\n| deleted_unix   | bigint(20)   | NULL              | YES  | MUL | NULL    |                | select,insert,update,references |         |\n| commit_time    | bigint(20)   | NULL              | YES  |     | NULL    |                | select,insert,update,references |         |\n| created_unix   | bigint(20)   | NULL              | YES  |     | NULL    |                | select,insert,update,references |         |\n| updated_unix   | bigint(20)   | NULL              | YES  |     | NULL    |                | select,insert,update,references |         |\n+----------------+--------------+-------------------+------+-----+---------+----------------+---------------------------------+---------+\n\n\u4fee\u6539\u8868\u7684\u5b57\u7b26\u96c6\nALTER TABLE branch CONVERT TO CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin';\n\u518d\u6b21\u67e5\u770b\u5b57\u7b26\u96c6\uff0c\u5df2\u7ecf\u4fee\u6539\u6210\u529f\u3002\nshow full columns from branch;\n+----------------+--------------+-------------+------+-----+---------+----------------+---------------------------------+---------+\n| Field          | Type         | Collation   | Null | Key | Default | Extra          | Privileges                      | Comment |\n+----------------+--------------+-------------+------+-----+---------+----------------+---------------------------------+---------+\n| id             | bigint(20)   | NULL        | NO   | PRI | NULL    | auto_increment | select,insert,update,references |         |\n| repo_id        | bigint(20)   | NULL        | YES  | MUL | NULL    |                | select,insert,update,references |         |\n| name           | varchar(255) | utf8mb4_bin | NO   |     | NULL    |                | select,insert,update,references |         |\n| commit_id      | varchar(255) | utf8mb4_bin | YES  |     | NULL    |                | select,insert,update,references |         |\n| commit_message | mediumtext   | utf8mb4_bin | YES  |     | NULL    |                | select,insert,update,references |         |\n| pusher_id      | bigint(20)   | NULL        | YES  |     | NULL    |                | select,insert,update,references |         |\n| is_deleted     | tinyint(1)   | NULL        | YES  | MUL | NULL    |                | select,insert,update,references |         |\n| deleted_by_id  | bigint(20)   | NULL        | YES  |     | NULL    |                | select,insert,update,references |         |\n| deleted_unix   | bigint(20)   | NULL        | YES  | MUL | NULL    |                | select,insert,update,references |         |\n| commit_time    | bigint(20)   | NULL        | YES  |     | NULL    |                | select,insert,update,references |         |\n| created_unix   | bigint(20)   | NULL        | YES  |     | NULL    |                | select,insert,update,references |         |\n| updated_unix   | bigint(20)   | NULL        | YES  |     | NULL    |                | select,insert,update,references |         |\n+----------------+--------------+-------------+------+-----+---------+----------------+---------------------------------+---------+\n\n\n\n3\u3001\u91cd\u65b0\u542f\u52a8\u5e94\u7528\uff0c\u6b63\u5e38\u3002<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u524d\u7248\u672cgitea 1.8 \u7531\u4e8e\u4e0d\u652f\u6301katex\uff0c\u51b3\u5b9a\u5347\u7ea7\u5230gitea1.24\u3002\u4e0d\u8fc7\u5347\u7ea7\u540e\uff0c\u6253\u5f00\u7f51\u9875\u70b9\u51fb\u9996\u9875\u5185 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/thereisno.top\/?p=1625\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cgitea\u5347\u7ea7\u540e\u62a5\u9519\u89e3\u51b3\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,103],"tags":[174,68],"class_list":["post-1625","post","type-post","status-publish","format-standard","hentry","category-mysql","category-103","tag-gitea","tag-mysql"],"_links":{"self":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/1625","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1625"}],"version-history":[{"count":4,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/1625\/revisions"}],"predecessor-version":[{"id":1635,"href":"https:\/\/thereisno.top\/index.php?rest_route=\/wp\/v2\/posts\/1625\/revisions\/1635"}],"wp:attachment":[{"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thereisno.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}