加入收藏 | 设为首页 | 会员中心 | 我要投稿 湖南网 (https://www.hunanwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 教程 > 正文

Discuz SQL语句大全:批量执行、配置、开关

发布时间:2021-03-31 06:53:33 所属栏目:教程 来源:网络整理
导读:网( LieHuo.Net )Discuz!论坛教程 信托各人都有这样的风俗,就是喜好把一些网络来的常识放在一路,本日就把Discuz!论坛的SQL语句大全网络了几十条,个中包罗批量执行、配置、开关、优化等多个语句,喜好的伴侣就保藏了吧~~ 以下是清算的SQL语句Discuz!版:

网(LieHuo.Net)Discuz!论坛教程 信托各人都有这样的风俗,就是喜好把一些网络来的常识放在一路,本日就把Discuz!论坛的SQL语句大全网络了几十条,个中包罗批量执行、配置、开关、优化等多个语句,喜好的伴侣就保藏了吧~~

以下是清算的SQL语句Discuz!版:

批量验证全部未验证的会员
UPDATE `cdb_members` SET `groupid` = '10' WHERE groupid='8';

DISCUZ论坛常用SQL语句
全部板块的非凡主题开启

UPDATE `cdb_forums` SET `allowpostspecial` = '31'

调解某个帖子的点击数
UPDATE cdb_threads SET views=点击数 WHERE tid=主题编号;

全部板块开启media代码

UPDATE `cdb_forums` SET `allowmediacode` = '1'

调解全部用户最大头像尺寸(像素)为120

update cdb_settings set value = 120 WHERE variable = 'maxavatarpixel'

一次性封锁板块fid20帖子

UPDATE `cdb_threads` SET `closed` = '1' WHERE `fid` =20 ;

把发帖数为0的用户都转到某个用户组

update cdb_members set groupid = * where posts = 0;

开启所有效户组的约请注册权限 并配置价值

UPDATE `cdb_usergroups` SET `allowinvite` = '1',`inviteprice` = '价值';

去除水印图片范例

replace INTO cdb_settings VALUES ('watermarktype','0');

调解用户最后登录时刻为 2007年8月10日

update cdb_members set lastpost='1186675200';

调解 板块潜匿的sql
UPDATE `cdb_forums` SET `status` = '1',
`lastpost` = '' WHERE `fid` =6 LIMIT 1 ;

完备封锁supesite的sql语句:

UPDATE `cdb_settings` SET `value` = '' WHERE `variable` = 'supe_siteurl' ;
UPDATE `cdb_settings` SET `value` = '' WHERE `variable` = 'supe_sitename';
UPDATE `cdb_settings` SET `value` = '0' WHERE `variable` = 'supe_status';
UPDATE `cdb_settings` SET `value` = '' WHERE `variable` = 'supe_tablepre';
UPDATE `cdb_settings` SET `value` = '0' WHERE `variable` = 'supe_circlestatus';

将A板块的全部帖子转到B板块的C分类里
update cdb_threads set fid=B板块ID,typeid=c分类的ID where fid=A板块ID;
update cdb_posts set fid=B板块ID where fid=A板块ID;

执行前备份一下数据库

去除靠山打点员ip登录限定
UPDATE `cdb_settings` SET `value` = '' WHERE CONVERT( `variable` USING utf8 ) ='adminipaccess' LIMIT 1 ;

删除气魄威风凛凛5
delete from cdb_styles where styleid=5 limit 1;

UPDATE `cdb_members` SET `pmsound` = '1'
论坛全部用户短动静提醒音修改为提醒音1

delete from cdb_usergroups where groupid = 0
删除groupid = 0的用户组

UPDATE `cdb_forums` SET `alloweditpost` = '1'
全部板块开启应承编辑帖子

论坛靠山 扫除insenz绑定语句

delete from cdb_settings where variable='insenz'

论坛靠山执行后 就可以 从头注册和绑定了

封锁旅客赏识全部版块的语句

可以这样结构SQL语句
update cdb_forumfields set viewperm =' 应承赏识的用户组的ID ' where fid in(论坛板块ID)

如:

update cdb_forumfields set viewperm =' 1 2 ' where fid in(1,2)

UPDATE `cdb_forumfields` SET `rules` = '板块法则'
全部板块的板块法则配置~!

UPDATE `cdb_forums` SET `jammer` = '1'
开启全部板块的滋扰码

开启全部会员组约请注册的权限
UPDATE cdb_usergroups SET allowinvite=1,allowmailinvite=1,maxinvitenum=10,maxinviteday=15,inviteprice=10;

//allowinvite 应承行使约请注册:
//allowmailinvite 应承发送约请注册:
//maxinvitenum 24小时内购置约请码最大数目:
//maxinviteday 约请码有用期:
//inviteprice 约请码购置价值:

修改最高日发帖数

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 &gt; 最小的 tid and tid &lt; 最大的 tid

指定范畴内的考核帖子通过考核
update cdb_posts set invisible = 0 where tid &gt; 最小的tid and tid &lt; 最大的 tid

批量删除未考核通过的帖子和主题
delete from cdb_threads where displayorder=-2;
delete from cdb_posts where invisible=-2;

批量封锁投票
UPDATE cdb_threads SET closed = 1 WHERE special=1

UPDATE `cdb_members` SET `secques` = ''
清空用户安详问答!

清空某个用户组的所有积分sql:

update cdb_members set credits = 0,extcredits1 = 0,extcredits2 = 0,extcredits3 = 0,extcredits4 = 0,extcredits5 = 0,extcredits6 = 0,extcredits7 = 0,extcredits8 = 0,where groupid = 用户组id;

update cdb_usergroups set allowtransfer=0

封锁全部用户组的积分转账

update cdb_threads set readperm=100 where dateline<1133300000

修改05年11月29日21点33份20秒 前的主题阅读权限100

个中1133300000 是unix时刻戳 (以秒为单元) 代表 05年11月29日21点33份20秒
readperm=100 代表阅读权限

把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

处事器上榨取IP会见呼吁

iptables -I INPUT -p TCP -s 218.0.211.0/24 --dport 80 -j DROP

查一个IP有哪个会员登录

select * from cdb_membsers where lastip="IP"

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` = '昨日发帖数 1428' 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 -1 1 1002 -1 1 100'
开启全部用户组的扩展积分1和2的评分值为 最小-1 最大1 24小时100

图片附件配置正确 可是不直接表现的调解sql:

update cdb_attachments set `isimage` =1 where SUBSTRING(`filename`,-3,3)='jpg' or SUBSTRING(`filename`,3)='gif'

牢靠天数内一部份附件到长途附件的sql
update cdb_attachments set remote = '1' where dateline<unix_timestamp()-86400*天数

修改全部用户组评分的SQL语句

update `cdb_usergroups` set `raterange`='扩展积分ID 评分最小值 评分最大值 24小时最大评分数扩展积分ID 评分最小值 评分最大值 24小时最大评分数'

将主题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;

关于教程之论坛栏目,请查察:http://www.veryhuo.com/code/bbs/

(编辑:湖南网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读