{"id":631,"date":"2023-02-26T11:21:10","date_gmt":"2023-02-26T03:21:10","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=631"},"modified":"2023-04-29T20:15:07","modified_gmt":"2023-04-29T12:15:07","slug":"mysql-modify-encoding","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/26\/mysql-modify-encoding\/","title":{"rendered":"MySQL\u4fee\u6539\u7f16\u7801"},"content":{"rendered":"<h2>\u4fee\u6539\u6570\u636e\u5e93\u7f16\u7801<\/h2>\n<pre><code class=\"language-sql\">ALTER DATABASE db_name [[DEFAULT] CHARACTER SET charset_name] [[DEFAULT] COLLATE collation_name]\n\nALTER DATABASE appblog CHARACTER SET utf8 COLLATE utf8_general_ci;<\/code><\/pre>\n<p><!-- more --><\/p>\n<h2>\u4fee\u6539\u6570\u636e\u5e93\u8868\u7f16\u7801<\/h2>\n<pre><code class=\"language-sql\">ALTER TABLE tbl_name [[DEFAULT] CHARACTER SET charset_name] [COLLATE collation_name]\n\nALTER TABLE t_app CHARACTER SET utf8 COLLATE utf8_general_ci\nALTER TABLE t_language CHARACTER SET utf8 COLLATE utf8_general_ci<\/code><\/pre>\n<h2>\u4fee\u6539\u8868\u5b57\u6bb5\u7f16\u7801<\/h2>\n<pre><code class=\"language-sql\">ALTER TABLE tbl_name MODIFY col_name {CHAR | VARCHAR | TEXT} (col_length) [CHARACTER SET charset_name] [COLLATE collation_name]\n\nALTER TABLE `t_app` MODIFY `language` VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci;\n\nALTER TABLE `t_app` CHANGE `language` `language` VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4fee\u6539\u6570\u636e\u5e93\u7f16\u7801 ALTER DATABASE db_name [[DEFAULT] CHARACTER SET [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-631","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=631"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/631\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}