{"id":411,"date":"2015-01-01T23:46:06","date_gmt":"2015-01-01T15:46:06","guid":{"rendered":"http:\/\/www.baishitou.cn\/?p=411"},"modified":"2015-01-01T23:46:06","modified_gmt":"2015-01-01T15:46:06","slug":"dede%e5%b8%b8%e7%94%a8sql%e8%af%ad%e5%8f%a5","status":"publish","type":"post","link":"https:\/\/www.baishitou.cn\/411.html","title":{"rendered":"DeDe\u5e38\u7528SQL\u8bed\u53e5"},"content":{"rendered":"

\u6e05\u7a7a\u6240\u6709\u6ce8\u518c\u4f1a\u5458\u5185\u5bb9<\/strong>
\nDELETE FROM `dede_member` WHERE `dede_member`.`mid` != 1;
\nTRUNCATE TABLE `dede_member_flink`;
\nTRUNCATE TABLE `dede_member_person`;
\nTRUNCATE TABLE `dede_member_space`;
\nTRUNCATE TABLE `dede_member_tj`;
\n\u6570\u636e\u8c03\u7528\u578b\u4f8b\u5b50<\/p>\n

\n\u6240\u6709\u53d1\u5e03\u7684\u6587\u7ae0\u603b\u6570\u76ee<\/strong>
\n{dede:sql sql='select\u00a0count(*) as cc from dede_archives'}
\n\u00a0\u00a0\u00a0[field:cc\/]
\n{\/dede:sql}<\/p>\n

\nDEDECMS\u529f\u80fd\u578bSQL\u8bed\u53e5\u6574\u7406\uff1a<\/span><\/strong><\/p>\n

\n

1.\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5c5e\u6027<\/strong><\/p>\n

insert into `dede_arcatt`(sortid,att,attname) values(9,'d','\u8bc4\u8bba');
\nalter table `dede_archives` modify `flag` set ('c','h','p','f','s','j','a','b','d') default NULL;<\/p>\n

2.\u6279\u91cf\u4e3a\u4f5c\u8005\u548c\u6765\u6e90\u8d4b\u503c<\/strong><\/p>\n

UPDATE dede_archives SET writer='\u8981\u8d4b\u7684\u503c' WHERE writer='';
\nUPDATE dede_archives SET source='\u8981\u8d4b\u7684\u503c' WHERE source='';<\/p>\n

3.\u5220\u9664\u6307\u5b9aIP\u7684\u8bc4\u8bba
\n<\/strong>
\nDELETE FROM `dede_feedback` WHERE `dede_feedback`.`ip` = '000.000.000.000'
\n
\n000.000.000.000 \u4e3a\u5783\u573e\u8bc4\u8bba\u53d1\u5e03\u8005\u7684IP\u00a0
\n
\n4.\u6e05\u7a7a\u6587\u7ae0\u4e2d\u5173\u952e\u5b57\u5b57\u6bb5<\/strong><\/p>\n

update dede_archives set keywords=''<\/p>\n

\n5.\u6279\u91cf\u66ff\u6362\u53d1\u5e03\u65f6\u95f4\uff0c\u5165\u5e93\u65f6\u95f4\uff0c\u66f4\u65b0\u65f6\u95f4<\/strong><\/p>\n

\u7b2c\u4e00\u6b65\u3002\u5728\u540e\u53f0\u65b0\u589e\u4e00\u4e2a\u6587\u7ae0\u3002
\n\u5f97\u5230\u4e00\u4e2a\u65f6\u95f4\uff0c\u6bd4\u59822009-01-13 14:13:32\uff0c\u8fd9\u53ef\u4ee5\u901a\u8fc7\u7ba1\u7406\u6587\u7ae0\u90a3\u91cc\u770b\u5230\u3002
\n\u7b2c\u4e8c\u6b65\uff0c\u540e\u53f0\u6267\u884cSQL\u8bed\u53e5SELECT * FROM dede_archives order by id DESC limit 1
\n\u8fd9\u6837\u4f60\u53ef\u4ee5\u770b\u5230\u4f60\u521a\u624d\u65b0\u52a0\u52a0\u7684\u6587\u7ae0\u4e00\u6240\u6709\u5b57\u6bb5\u503c\u3002
\n\u89c2\u5bdf\u4ee5\u4e0b\u7684\u6570\u636e\uff1a
\npubdate\uff1a1231846313
\nsenddate\uff1a1231846313
\nsortrank\uff1a1231846313
\n\u5176\u4e2d1231846313\u5c31\u662f\u65f6\u95f4\u6570\u636e\u4e86\u3002
\n\u7136\u540e\u5c31\u662f\u66ff\u6362\u4e86\u3002
\nUPDATE dede_archives SET sortrank = 1231846313;
\nUPDATE dede_archives SET senddate = 1231846313;
\nUPDATE dede_archives SET pubdate = 1231846313;<\/p>\n

6.\u6279\u91cf\u4fee\u6539\u680f\u76ee\u4e3a\u52a8\u6001\u6216\u8005\u9759\u6001<\/strong><\/p>\n

UPDATE `dede_arctype` SET `isdefault` = '-1' \u52a8\u6001
\nUPDATE `dede_arctype` SET `isdefault` = '1' \u9759\u6001<\/p>\n

\n7.\u6587\u7ae0\u5185\u5bb9\u6279\u91cf\u66ff\u6362SQL\u8bed\u53e5<\/strong><\/p>\n

update `dede_addonarticle` set body=REPLACE(body,'\u8bba\u575b','\u793e\u533a') where body like \"%\u8bba\u575b%\"
\n\u4ee5\u4e0aSQL\u8bed\u53e5\u4f5c\u7528\u662f\u67e5\u627e\u6240\u6709\u6587\u7ae0\u5e26\u6709\u201c\u8bba\u575b\u201d\u7684\u8bcd\u7ec4\uff0c\u5e76\u5c06\u8bba\u575b\u66ff\u6362\u4e3a\u201c\u793e\u533a\u201d<\/p>\n

8.\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5c5e\u6027<\/strong><\/p>\n

insert into `dede_arcatt`(sortid,att,attname) values(9,'d','\u8bc4\u8bba');
\nalter table `dede_archives` modify `flag` set ('c','h','p','f','s','j','a','b','d') default NULL;<\/p>\n

\n9.\u6279\u91cf\u4e3a\u4f5c\u8005\u548c\u6765\u6e90\u8d4b\u503c<\/strong><\/p>\n

UPDATE dede_archives SET writer='\u8981\u8d4b\u7684\u503c' WHERE writer='';
\nUPDATE dede_archives SET source='\u8981\u8d4b\u7684\u503c' WHERE source='';<\/p>\n

10.\u66f4\u6539\u7f29\u7565\u56fe\u76ee\u5f55
\n<\/strong>
\nSQL\u547d\u4ee4\uff1aupdate dede_archives set litpic=replace(litpic,'\u539f\u6765\u7684\u5b57\u7b26','\u66ff\u6362\u540e\u7684\u5b57\u7b26')
\n\u4f8b\u5982\uff1aupdate dede_archives set litpic=replace(litpic,'uplimg,'tupian')<\/p>\n

update dede_addonarticle set body=replace(body,'src=\"\/upimg\/PSImg','src=\"\/upimg\/PSImage') where typeid=90;<\/p>\n

\u00a0<\/p>\n

\u4ee5\u4e0b\u662fdede\u4e2d\u5e38\u7528sql\u7edf\u8ba1\u6807\u7b7e\uff0c\u4f9b\u5927\u5bb6\u53c2\u8003\uff1a<\/strong><\/p>\n

\u00b7\u5171\u6709\u6587\u7ae0\uff1a** \u7bc7
\n{dede:sql sql=\"select count(ID) as c from dede_archives where channel=1\"}\u00b7\u5171\u6709\u6587\u7ae0\uff1a[field:c \/]\u7bc7{\/dede:sql}<\/p>\n

\u00b7\u5171\u6709\u56fe\u96c6\uff1a** \u4e2a
\n{dede:sql sql=\"select count(ID) as c from dede_archives where channel=2\"}\u00b7\u5171\u6709\u56fe\u96c6\uff1a[field:c \/]\u4e2a{\/dede:sql}<\/p>\n

\u00b7\u5171\u6709\u8f6f\u4ef6\uff1a** \u4e2a
\n{dede:sql sql=\"select count(ID) as c from dede_archives where channel=3\"}\u00b7\u5171\u6709\u8f6f\u4ef6\uff1a[field:c \/]\u4e2a{\/dede:sql}<\/p>\n

\u00b7\u5171\u6709\u8bc4\u8bba\uff1a**\u6761
\n{dede:sql sql=\"select count(ID) as c from dede_feedback\"}\u00b7\u5171\u6709\u8bc4\u8bba\uff1a[field:c \/]\u6761{\/dede:sql}<\/p>\n

\u00b7\u5171\u6709\u4f1a\u5458\uff1a**\u540d
\n{dede:sql sql=\"select count(*) as c from dede_member \"}\u00b7\u5171\u6709\u4f1a\u5458\uff1a[field:c \/]\u540d{\/dede:sql}<\/p>\n

\u00b7\u6587\u7ae0\u9605\u8bfb\uff1a** \u4eba\u6b21
\n{dede:sql sql=\"select sum(click) as c from dede_archives\"}\u6587\u7ae0\u9605\u8bfb\uff1a[field:c \/]\u4eba\u6b21{\/dede:sql}<\/p>\n","protected":false},"excerpt":{"rendered":"

\u6e05\u7a7a\u6240\u6709\u6ce8\u518c\u4f1a\u5458\u5185\u5bb9 DELETE FROM `dede_member` WHERE `dede_member […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[115],"class_list":["post-411","post","type-post","status-publish","format-standard","hentry","category-web","tag-dede"],"_links":{"self":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/comments?post=411"}],"version-history":[{"count":0,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/411\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/media?parent=411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/categories?post=411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/tags?post=411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}