UPDATE `cdb_settings` SET `value` = '昨日發帖數 最高日發帖數' WHERE `variable` ='historyposts' LIMIT 1 ;
昨日發帖數 和 最高日發帖數修改為你需要的數字即可, 升級完sql後,更新緩存
'昨日發帖數 最高日發帖數' 中間的空格是tab鍵~!
UPDATE `cdb_settings` SET `value` = '0' WHERE CONVERT( `variable` USING utf8 ) = 'gzipcompress' LIMIT 1 ;
關閉論壇的gzip設置!
批量對用戶組禁言
update cdb_members set adminid='-1', groupid='4' where groupid='?';
delete from cdb_threads where authorid=0;
delete from cdb_posts where authorid=0;
批量刪除遊客組的發帖和主題
uid 2000~3000的會員全部積分清零
update cdb_members set credits=0,extcredits1=0,extcredits2=0,extcredits3=0,extcredits4=0,extcredits5=0,extcredits6=0,extcredits7=0,extcredits8=0 where uid > 2000 and uid < 3000;
指定範圍內的審核主題通過審核
update cdb_threads set displayorder=0 where tid > 最小的 tid and tid < 最大的 tid
指定範圍內的審核帖子通過審核
update cdb_posts set invisible = 0 where tid > 最小的tid and tid < 最大的 tid
批量刪除未審核通過的帖子和主題
delete from cdb_threads where displayorder=-2;
delete from cdb_posts where invisible=-2;
批量關閉投票
UPDATE cdb_threads SET closed = 1 WHERE special=1
把2005年1月1日以前的閱讀權限設高.
update cdb_threads set readperm=100 where dateline<1104537600 and digest=0
批量替換帖子裡面的評分者的用戶名
update cdb_ratelog set uid = '新uid', username = '新username' where uid = '舊的 uid';
所有的附件默認閱讀權限為1
update cdb_attachments set readperm=1
統計發帖量大約0的所有用戶積分1的總量
SELECT count(`extcredits1`) FROM `cdb_members` where `posts`=0
批量修改 uid1~6會員的 showemail 為 1
UPDATE `cdb_members` SET `showemail` ='1' WHERE `uid` in(1,2,3,4,5,6);
將主題tid大於14651的所有主題減去16761780
update cdb_threads set tid=tid-16761780 where tid>14651;
update cdb_posts set tid=tid-16761780 where tid>14651;
update cdb_attachments set tid=tid-16761780 where tid>14651;
update cdb_myposts set tid=tid-16761780 where tid>14651;
update cdb_activities set tid=tid-16761780 where tid>14651;
update cdb_activityapplies set tid=tid-16761780 where tid>14651;
update cdb_favorites set tid=tid-16761780 where tid>14651;
update cdb_mythreads set tid=tid-16761780 where tid>14651;
update cdb_paymentlog set tid=tid-16761780 where tid>14651;
update cdb_polloptions set tid=tid-16761780 where tid>14651;
update cdb_polls set tid=tid-16761780 where tid>14651;
update cdb_pushedthreads set tid=tid-16761780 where tid>14651;
update cdb_relatedthreads set tid=tid-16761780 where tid>14651;
update cdb_rewardlog set tid=tid-16761780 where tid>14651;
update cdb_rsscaches set tid=tid-16761780 where tid>14651;
update cdb_sessions set tid=tid-16761780 where tid>14651;
update cdb_subscriptions set tid=tid-16761780 where tid>14651;
update cdb_threadsmod set tid=tid-16761780 where tid>14651;
update cdb_tradelog set tid=tid-16761780 where tid>14651;
update cdb_trades set tid=tid-16761780 where tid>14651;
此操作前請注意備份!!(按照5.0數據表進行修改的 6.0的需要查看下數據庫對比下)
將積分1加到積分2上 並清零積分1的sql
update cdb_members set extcredits1=extcredits1+extcredits2;
update cdb_members set extcredits1='0';
把300天未登錄的ID移到某一特殊用戶組
update cdb_members set adminid=-1,groupid=特殊用戶組ID where lastactivity< unix_timestamp()-300*24*3600
UPDATE cdb_posts p, cdb_attachments a SET p.attachment=1 WHERE p.pid=a.pid;
找回丟失附件的sql語句
更新昨日發貼數
昨日發貼數:
select count(*) from cdb_posts where dateline>昨天0時的時間戳 and dateline<今天0時的時間戳
更新昨日發貼數:
UPDATE `cdb_settings` SET `value` = '昨日發帖數\t1428' WHERE `variable` ='historyposts' LIMIT 1 ;
把"新手上路"用戶組下的所有會員轉換到另一個特殊的用戶組
pl: 特殊用戶組沒有關聯任何的管理組
update cdb_members set groupid=特殊用戶組的id where groupid=新手上路用戶組的id and adminid=0
刪除一個板塊的所有回覆
delete from cdb_posts where fid = '需要刪除回覆的版塊id' and first = 0;
delete from cdb_forums where fid=23 limit 1;
刪除fid23的板塊
圈子sgid字段缺少 添加的sql
ALTER TABLE cdb_threads ADD sgid mediumint(8) unsigned NOT NULL default '0'
update cdb_threads set replies=(select count(*) from cdb_posts where tid=47708) where tid=47708
更新 tid27708主題的統計
關閉所有板塊的允許其它模塊共享
update cdb_forums set allowshare=0
UPDATE `cdb_memberfields` SET `sightml` = ' '
所有用戶的簽名清空
UPDATE cdb_posts SET subject=REPLACE(subject,'#','樓');
批量替換帖子中的回覆* #的顯示為 *樓
刪除一個主題的所有回覆
delete from cdb_posts where tid = '需要刪除回覆的主題的tid' and first = 0;
UPDATE `cdb_settings` SET `value` = '1' WHERE CONVERT( `variable` USING utf8 ) = 'thumbstatus' LIMIT 1 ;
設置縮略圖為 為圖片附件添加縮略圖
UPDATE `cdb_settings` SET `value` = '2' WHERE CONVERT( `variable` USING utf8 ) = 'thumbstatus' LIMIT 1 ;
設置縮略圖為 將圖片附件縮到指定的大小
批量驗證所有未驗證的會員
UPDATE `cdb_members` SET `groupid` = '10' WHERE groupid='8';
批量刪除遊客回帖和主題
delete from cdb_threads where authorid=0;
delete from cdb_posts where authorid=0;
刪除在180天之前的全部短消息
delete from cdb_pms where dateline<1190518730
清空某個用戶的已發短消息
update cdb_pms set delstatus=1 where msgfromid=發送者ID
所有用戶組(包括系統用戶組,普通用戶組,特殊用戶組)都可以參與投票的SQL語句:
update cdb_usergroups set allowvote=1 where groupid<4 or groupid>9
UPDATE `cdb_usergroups` SET `raterange` = '1\t-1\t1\t100\n2\t-1\t1\t100'
開啟所有用戶組的擴展積分1和2的評分值為 最小-1 最大1 24小時100
圖片附件設置正確 但是不直接顯示的調整sql:
update cdb_attachments set `isimage` =1 where SUBSTRING(`filename`,-3,3)='jpg' or SUBSTRING(`filename`,-3,3)='gif'
固定天數內一部份附件到遠程附件的sql
update cdb_attachments set remote = '1' where dateline<unix_timestamp()-86400*天數
修改所有用戶組評分的SQL語句
update `cdb_usergroups` set `raterange`='擴展積分ID\t評分最小值\t評分最大值\t24小時最大評分數\n擴展積分ID\t評分最小值\t評分最大值\t24小時最大評分數'
將主題tid大於4009的所有主題減去16773200
update cdb_activities set tid=tid-16773200 where tid>4009;
update cdb_activityapplies set tid=tid-16773200 where tid>4009;
update cdb_attachments set tid=tid-16773200 where tid>4009;
update cdb_campaigns set tid=tid-16773200 where tid>4009;
update cdb_debateposts set tid=tid-16773200 where tid>4009;
update cdb_debates set tid=tid-16773200 where tid>4009;
update cdb_favorites set tid=tid-16773200 where tid>4009;
update cdb_forumrecommend set tid=tid-16773200 where tid>4009;
update cdb_myposts set tid=tid-16773200 where tid>4009;
update cdb_mythreads set tid=tid-16773200 where tid>4009;
update cdb_paymentlog set tid=tid-16773200 where tid>4009;
update cdb_polloptions set tid=tid-16773200 where tid>4009;
update cdb_polls set tid=tid-16773200 where tid>4009;
update cdb_posts set tid=tid-16773200 where tid>4009;
update cdb_relatedthreads set tid=tid-16773200 where tid>4009;
update cdb_rewardlog set tid=tid-16773200 where tid>4009;
update cdb_rsscaches set tid=tid-16773200 where tid>4009;
update cdb_sessions set tid=tid-16773200 where tid>4009;
update cdb_subscriptions set tid=tid-16773200 where tid>4009;
update cdb_threads set tid=tid-16773200 where tid>4009;
update cdb_threadsmod set tid=tid-16773200 where tid>4009;
update cdb_threadtags set tid=tid-16773200 where tid>4009;
update cdb_tradelog set tid=tid-16773200 where tid>4009;
update cdb_trades set tid=tid-16773200 where tid>4009;
update cdb_typeoptionvars set tid=tid-16773200 where tid>4009;
update cdb_videos set tid=tid-16773200 where tid>4009;
update cdb_videotags set tid=tid-16773200 where tid>4009;
如果安裝了supesite 有了推送主題表還加上:
update cdb_pushedthreads set tid=tid-16773200 where tid>4009;
以上sql 為6.0版本
批量替換論壇標題內容
UPDATE `cdb_threads` SET `subject` = replace (`subject`,'需要替換的','替換後的')
UPDATE `cdb_attachments` SET `thumb` = '0'
取消所有附件的縮略圖數據
UPDATE `cdb_threads` SET `highlight` = '0'
取消全部帖子的高亮顯示
論壇裡所有回覆長度小於20的而且沒有附件的貼子全部刪除掉
delete from cdb_posts where length(message)<20 and attachment=0
查詢 ftp上的附件是否在數據庫內
phpmyadmin中 執行sql:
select * from cdb_attachments where attachment like "%文件名稱%"
一次性給一個貼內的所有回帖人加積分
update cdb_members set extcredits2=extcredits2+10 where uid in(SELECT authorid FROM `cdb_posts` WHERE tid=主題ID)
extcredits2 是需要增加的積分字段 ,使用的時候要注意增加的哪個積分字段
truncate cdb_validating
清空用戶審核數據表
UPDATE `cdb_members` SET `oltime` = '0'
所有用戶的在線時間修改為0
把體積大於 819200kb的附件指定為遠程附件
update cdb_attachments set remote = '1' WHERE filesize > 819200
ALTER TABLE `cdb_threads` CHANGE `tid` `tid` MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT; 作者: zsuzr 時間: 2011-3-23 11:51