请选择 进入手机版 | 继续访问电脑版
搜索
猜你喜欢
查看: 1579|回复: 4

在phpmyadmin中批量替换某字段中某个特定值的命令

  [复制链接]

参加活动:2

组织活动:4

being 发表于 2012-11-1 17:37:43 | 显示全部楼层 |阅读模式
  1. UPDATE `数据库名`.`表名` SET `字段名` =replace(`字段名`,'替换前字段','替换后字段')where `字段名` LIKE '%替换前字段%'
复制代码
在phpmyadmin中批量替换某字段中某个特定值的命令
[micxp_gzhmm=考试密码,X1X2X]
  1. <p><p><p><p><p>UPDATE ayrdz6000_ds_docinfo SET `title`=replace(title,',','-') WHERE `docid`='155'



  2. UPDATE ayrdz6000_ds_docinfo SET `short`=replace(short,',','-') WHERE `docid`='155'</p><p>
  3. </p><p>
  4. </p><p>UPDATE `ayrdz6000_forum_post` SET `message` = replace( message, '[micxp_gzhmm=考试密码,X1X2X]', '[micxp_gzhmm=生物化学2,AES3LI]' ), `message` = replace( message, '[/micxp_gzhmm]', '[/micxp_gzhmm]' ) WHERE `subject` like '%生物化学%' and `message` like '%[micxp_gzhmm=考试密码,X1X2X][url=http%';
  5. INSERT INTO `ayrdz6000_tom_weixin_reply` (`id`, `reply_cmd`, `reply_type`, `reply_desc`, `reply_text`, `part1`, `part2`, `part3`) VALUES (NULL, '生物化学2', '1', '生物化学2', 'AES3LI', NULL, NULL, NULL);</p><p>
  6. </p><p>
  7. UPDATE `cdb_forums` SET `allowpostspecial` = ‘31′</p><p>所有板块的特殊主题开启</p><p>调整某个帖子的点击数
  8. UPDATE cdb_threads SET views=点击数 WHERE tid=主题编号;</p><p>调整某个版块的点击数
  9. UPDATE cdb_threads SET views=100 WHERE fid=152;</p><p>UPDATE `cdb_forums` SET `allowmediacode` = ‘1′
  10. 所有板块开启media代码</p><p>update cdb_settings set value = 120 WHERE variable = ‘maxavatarpixel’
  11. 调整所有用户最大头像尺寸(像素)为120</p><p>UPDATE `cdb_threads` SET `closed` = ‘1′ WHERE `fid` =20 ;
  12. 一次性关闭板块fid20帖子</p><p>把发帖数为0的用户都转到某个用户组</p><p>update cdb_members set groupid = * where posts = 0;</p><p>UPDATE `cdb_usergroups` SET `allowinvite` = ‘1′, `inviteprice` = ‘价格’;
  13. 开启全部用户组的邀请注册权限  并设置价格</p><p>replace INTO cdb_settings VALUES (‘watermarktype’,'0′);
  14. 去除水印图片类型</p><p>update cdb_members set lastpost=’1186675200′;
  15. 调整用户最后登录时间为 2007年8月10日
  16. UPDATE `cdb_forums` SET `status` = ‘1′,
  17. `lastpost` = ” WHERE `fid` =6 LIMIT 1 ;</p><p>调整 板块隐藏的sql!</p><p>完整关闭supesite的sql语句:</p><p>UPDATE `cdb_settings` SET `value` = ” WHERE `variable` = ’supe_siteurl’ ;
  18. UPDATE `cdb_settings` SET `value` = ” WHERE  `variable`   = ’supe_sitename’;
  19. UPDATE `cdb_settings` SET `value` = ‘0′ WHERE `variable`  = ’supe_status’;
  20. UPDATE `cdb_settings` SET `value` = ” WHERE `variable`    = ’supe_tablepre’;
  21. UPDATE `cdb_settings` SET `value` = ‘0′ WHERE `variable`  = ’supe_circlestatus’;</p><p>将A板块的所有帖子转到B板块的C分类里
  22. update cdb_threads set fid=B板块ID,typeid=c分类的ID where  fid=A板块ID;
  23. update cdb_posts set fid=B板块ID  where  fid=A板块ID;</p><p>执行前备份一下数据库</p><p>去除后台管理员ip登录限制
  24. UPDATE `cdb_settings` SET `value` = ” WHERE CONVERT( `variable` USING utf8 ) =’adminipaccess’ LIMIT 1 ;
  25. 删除风格5
  26. delete from cdb_styles where styleid=5 limit 1;
  27. UPDATE `cdb_members` SET `pmsound` = ‘1′
  28. 论坛所有用户短消息提示音修改为提示音1
  29. delete from cdb_usergroups where groupid = 0
  30. 删除groupid = 0的用户组
  31. UPDATE `cdb_forums` SET `alloweditpost` = ‘1′
  32. 所有板块开启允许编辑帖子</p><p>论坛后台 解除insenz绑定语句</p><p>delete from cdb_settings where variable=’insenz’</p><p>论坛后台执行后 就可以 重新注册和绑定了
  33. 关闭游客浏览所有版块的语句</p><p>可以这样构造SQL语句
  34. update cdb_forumfields  set  viewperm =’t允许浏览的用户组的IDt’  where  fid in(论坛板块ID)</p><p>如:</p><p>update cdb_forumfields  set  viewperm =’t1t2t’  where  fid in(1,2)</p><p>UPDATE `cdb_forumfields` SET `rules` = ‘板块规则’
  35. 所有板块的板块规则设置~!
  36. UPDATE `cdb_forums` SET `jammer` = ‘1′
  37. 开启所有板块的干扰码
  38. 开启所有会员组邀请注册的权限
  39. UPDATE cdb_usergroups SET allowinvite=1, allowmailinvite=1, maxinvitenum=10, maxinviteday=15, inviteprice=10;</p><p>//allowinvite  允许使用邀请注册:
  40. //allowmailinvite 允许发送邀请注册:
  41. //maxinvitenum 24小时内购买邀请码最大数量:
  42. //maxinviteday 邀请码有效期:
  43. //inviteprice 邀请码购买价格:</p><p>修改最高日发帖数</p><p>UPDATE `cdb_settings` SET `value` = ‘昨日发帖数 最高日发帖数’ WHERE `variable` =’historyposts’ LIMIT 1 ;</p><p>昨日发帖数 和  最高日发帖数 修改为你需要的数字即可, 升级完sql后,更新缓存
  44. ‘昨日发帖数 最高日发帖数’ 中间的空格是tab键~!</p><p>UPDATE `cdb_settings` SET `value` = ‘0′ WHERE CONVERT( `variable` USING utf8 ) = ‘gzipcompress’ LIMIT 1 ;</p><p>关闭论坛的gzip设置!</p><p>批量对用户组禁言
  45. update cdb_members set adminid=’-1′, groupid=’4′ where groupid=’?';</p><p>delete from cdb_threads where authorid=0;
  46. delete from cdb_posts where authorid=0;
  47. 批量删除游客组的发帖和主题</p><p>uid 2000~3000的会员全部积分清零
  48. update cdb_members set</p><p>credits=0,extcredits1=0,extcredits2=0,extcredits3=0,extcredits4=0,extcredits5=0,extcredits6=0,extcredits7=0,extc</p><p>redits8=0 where uid > 2000 and uid &lt; 3000;
  49. 指定范围内的审核主题通过审核</p><p>update cdb_threads set displayorder=0 where tid &gt; 最小的 tid and tid &lt; 最大的 tid
  50. 指定范围内的审核帖子通过审核
  51. update cdb_posts set invisible = 0 where tid &gt; 最小的tid and tid &lt; 最大的 tid
  52. 批量删除未审核通过的帖子和主题
  53. delete from cdb_threads  where displayorder=-2;
  54. delete from cdb_posts  where invisible=-2;</p><p>批量关闭投票
  55. UPDATE cdb_threads SET closed = 1 WHERE special=1</p><p>UPDATE `cdb_members` SET `secques` = ”
  56. 清空用户安全问答!
  57. 清空某个用户组的全部积分sql:</p><p>update cdb_members set credits = 0, extcredits1 = 0, extcredits2 = 0, extcredits3 = 0, extcredits4 = 0,</p><p>extcredits5 = 0, extcredits6 = 0, extcredits7 = 0, extcredits8 = 0, where groupid = 用户组id;</p><p>update cdb_usergroups set allowtransfer=0
  58. 关闭所有用户组的积分转账</p><p>update cdb_threads set readperm=100 where dateline&lt;1133300000 </p><p>修改05年11月29日21点33份20秒   前的主题阅读权限100</p><p>其中1133300000 是unix时间戳 (以秒为单位) 代表 05年11月29日21点33份20秒  
  59. readperm=100 代表阅读权限</p><p>把2005年1月1日以前的阅读权限设高.
  60. update cdb_threads set readperm=100 where dateline&lt;1104537600 and digest=0
  61. 批量替换帖子里面的评分者的用户名
  62. update cdb_ratelog set uid = ‘新uid’, username = ‘新username’ where uid = ‘旧的 uid’;
  63. 所有的附件默认阅读权限为1
  64. update cdb_attachments set readperm=1
  65. 统计发帖量大约0的所有用户积分1的总量
  66. SELECT count(`extcredits1`) FROM `cdb_members` where `posts`=0
  67. 批量修改uid1~6会员的 showemail 为 1
  68. UPDATE `cdb_members` SET `showemail` =’1′ WHERE `uid` in(1,2,3,4,5,6);
  69. 将主题tid大于14651的所有主题减去16761780
  70. update cdb_threads set tid=tid-16761780 where tid>14651;
  71. update cdb_posts set tid=tid-16761780 where tid>14651;
  72. update cdb_attachments set tid=tid-16761780 where tid>14651;
  73. update cdb_myposts set tid=tid-16761780 where tid>14651;
  74. update cdb_activities set tid=tid-16761780 where tid>14651;
  75. update cdb_activityapplies set tid=tid-16761780 where tid>14651;
  76. update cdb_favorites set tid=tid-16761780 where tid>14651;
  77. update cdb_mythreads set tid=tid-16761780 where tid>14651;
  78. update cdb_paymentlog set tid=tid-16761780 where tid>14651;
  79. update cdb_polloptions set tid=tid-16761780 where tid>14651;
  80. update cdb_polls set tid=tid-16761780 where tid>14651;
  81. update cdb_pushedthreads set tid=tid-16761780 where tid>14651;
  82. update cdb_relatedthreads set tid=tid-16761780 where tid>14651;
  83. update cdb_rewardlog set tid=tid-16761780 where tid>14651;
  84. update cdb_rsscaches set tid=tid-16761780 where tid>14651;
  85. update cdb_sessions set tid=tid-16761780 where tid>14651;
  86. update cdb_subscriptions set tid=tid-16761780 where tid>14651;
  87. update cdb_threadsmod set tid=tid-16761780 where tid>14651;
  88. update cdb_tradelog set tid=tid-16761780 where tid>14651;
  89. update cdb_trades set tid=tid-16761780 where tid>14651;</p><p>此操作前请注意备份!!(按照5.0数据表进行修改的  6.0的需要查看下数据库对比下)
  90. 将积分1加到积分2上  并清零积分1的sql</p><p>update cdb_members set extcredits1=extcredits1+extcredits2;
  91. update cdb_members set extcredits1=’0′;
  92. 把300天未登录的ID移到某一特殊用户组
  93. update cdb_members set adminid=-1,groupid=特殊用户组ID where  lastactivity&lt; unix_timestamp()-300*24*3600</p><p>服务器上禁止IP访问命令</p><p>iptables -I INPUT -p TCP -s 218.0.211.0/24 –dport 80 -j DROP
  94. 查一个IP有哪个会员登录</p><p>select * from cdb_membsers where lastip=”IP”
  95. UPDATE cdb_posts p, cdb_attachments a SET p.attachment=1 WHERE p.pid=a.pid;
  96. 找回丢失附件的sql语句</p><p>更新昨日发贴数</p><p>昨日发贴数:
  97.     select count(*) from cdb_posts where   dateline>昨天0时的时间戳 and     dateline&lt;今天0时的时间戳
  98. 更新昨日发贴数:
  99.     UPDATE `cdb_settings` SET `value` = ‘昨日发帖数t1428′ WHERE `variable` =’historyposts’ LIMIT 1 ;
  100. 把”新手上路”用户组下的所有会员转换到另一个特殊的用户组</p><p>pl:特殊用户组没有关联任何的管理组</p><p>update cdb_members set groupid=特殊用户组的id where groupid=新手上路用户组的id and adminid=0
  101. 删除一个板块的所有回复
  102. delete from cdb_posts where fid = ‘需要删除回复的版块id’ and first = 0;
  103. delete from cdb_forums where fid=23 limit 1;
  104. 删除fid23的板块
  105. 圈子sgid字段缺少 添加的sql</p><p>ALTER TABLE cdb_threads ADD sgid mediumint(8) unsigned NOT NULL default ‘0′
  106. update cdb_threads set replies=(select count(*) from cdb_posts where tid=47708) where tid=47708</p><p>更新tid27708主题的统计
  107. 关闭所有板块的允许其它模块共享
  108. update cdb_forums set allowshare=0</p><p>UPDATE `cdb_memberfields` SET `sightml` = ‘ ‘</p><p>所有用户的签名清空</p><p>UPDATE cdb_posts SET subject=REPLACE(subject,’#',’楼’);</p><p>批量替换帖子中的回复* #的显示为 *楼
  109. 删除一个主题的所有回复
  110. delete from cdb_posts where tid = ‘需要删除回复的主题的tid’ and first = 0;
  111. UPDATE `cdb_settings` SET `value` = ‘1′ WHERE CONVERT( `variable` USING utf8 ) = ‘thumbstatus’ LIMIT 1 ;
  112. 设置缩略图为     为图片附件添加缩略图
  113. UPDATE `cdb_settings` SET `value` = ‘2′ WHERE CONVERT( `variable` USING utf8 ) = ‘thumbstatus’ LIMIT 1 ;
  114. 设置缩略图为     将图片附件缩到指定的大小</p><p>批量验证所有未验证的会员
  115. UPDATE `cdb_members` SET `groupid` = ‘10′ WHERE groupid=’8′;</p><p>批量删除游客回帖和主题</p><p>delete from cdb_threads where authorid=0;
  116. delete from cdb_posts where authorid=0;
  117. 删除在180天之前的全部短消息
  118. delete from cdb_pms where dateline&lt;1190518730
  119. 清空某个用户的已发短消息
  120.    
  121. update cdb_pms set delstatus=1 where msgfromid=发送者ID</p><p>所有用户组(包括系统用户组,普通用户组,特殊用户组)都可以参与投票的SQL语句:
  122. update cdb_usergroups set allowvote=1 where groupid&lt;4 or groupid>9
  123. UPDATE `cdb_usergroups` SET `raterange` = ‘1t-1t1t100n2t-1t1t100′
  124. 开启所有用户组的扩展积分1和2的评分值为 最小-1 最大1 24小时100
  125. 图片附件设置正确 但是不直接显示的调整sql:</p><p>update cdb_attachments set `isimage` =1 where SUBSTRING(`filename`,-3,3)=’jpg’ or SUBSTRING(`filename`,-3,3)</p><p>=’gif’</p><p>固定天数内一部份附件到远程附件的sql
  126. update cdb_attachments set remote = ‘1′ where dateline&lt;unix_timestamp()-86400*天数
  127. 修改所有用户组评分的SQL语句
  128.    
  129. update `cdb_usergroups` set `raterange`=’扩展积分IDt评分最小值t评分最大值t24小时最大评分数n扩展积分IDt评分</p><p>最小值t评分最大值t24小时最大评分数’
  130. 将主题tid大于4009的所有主题减去16773200</p><p>update cdb_activities set tid=tid-16773200 where tid>4009;
  131. update cdb_activityapplies set tid=tid-16773200 where tid>4009;
  132. update cdb_attachments set tid=tid-16773200 where tid>4009;
  133. update cdb_campaigns set tid=tid-16773200 where tid>4009;
  134. update cdb_debateposts set tid=tid-16773200 where tid>4009;
  135. update cdb_debates set tid=tid-16773200 where tid>4009;
  136. update cdb_favorites set tid=tid-16773200 where tid>4009;
  137. update cdb_forumrecommend set tid=tid-16773200 where tid>4009;
  138. update cdb_myposts set tid=tid-16773200 where tid>4009;
  139. update cdb_mythreads set tid=tid-16773200 where tid>4009;
  140. update cdb_paymentlog set tid=tid-16773200 where tid>4009;
  141. update cdb_polloptions set tid=tid-16773200 where tid>4009;
  142. update cdb_polls set tid=tid-16773200 where tid>4009;
  143. update cdb_posts set tid=tid-16773200 where tid>4009;
  144. update cdb_relatedthreads set tid=tid-16773200 where tid>4009;
  145. update cdb_rewardlog set tid=tid-16773200 where tid>4009;
  146. update cdb_rsscaches set tid=tid-16773200 where tid>4009;
  147. update cdb_sessions set tid=tid-16773200 where tid>4009;
  148. update cdb_subscriptions set tid=tid-16773200 where tid>4009;
  149. update cdb_threads set tid=tid-16773200 where tid>4009;
  150. update cdb_threadsmod set tid=tid-16773200 where tid>4009;
  151. update cdb_threadtags set tid=tid-16773200 where tid>4009;
  152. update cdb_tradelog set tid=tid-16773200 where tid>4009;
  153. update cdb_trades set tid=tid-16773200 where tid>4009;
  154. update cdb_typeoptionvars set tid=tid-16773200 where tid>4009;
  155. update cdb_videos set tid=tid-16773200 where tid>4009;
  156. update cdb_videotags set tid=tid-16773200 where tid>4009;</p><p>如果安装了supesite  有了推送主题表还加上:
  157. update cdb_pushedthreads set tid=tid-16773200 where tid>4009;</p><p>以上sql为6.0版本</p><p>批量替换论坛标题内容
  158. UPDATE `cdb_threads` SET `subject` = replace (`subject`,’需要替换的’,'替换后的’)
  159. UPDATE `cdb_attachments` SET `thumb` = ‘0′
  160. 取消所有附件的缩略图数据
  161. UPDATE `cdb_threads` SET `highlight` = ‘0′
  162. 取消全部帖子的高亮显示</p><p>论坛里所有回复长度小于20的而且没有附件的贴子全部删除掉
  163. delete from cdb_posts where length(message)&lt;20 and attachment=0
  164. 查询ftp上的附件是否在数据库内
  165. phpmyadmin中 执行sql:
  166. select * from cdb_attachments where attachment like “%文件名称%”
  167. 一次性给一个贴内的所有回帖人加积分
  168. update cdb_members set extcredits2=extcredits2+10  where uid in(SELECT authorid FROM `cdb_posts` WHERE tid=主题</p><p>ID)</p><p>extcredits2  是需要增加的积分字段 , 使用的时候要注意增加的哪个积分字段</p><p>truncate cdb_validating
  169. 清空用户审核数据表
  170. UPDATE `cdb_members` SET `oltime` = ‘0′</p><p>所有用户的在线时间修改为0</p><p>把体积大于 819200kb的附件指定为远程附件
  171. update cdb_attachments set remote = ‘1′ WHERE filesize > 819200</p><p>ALTER TABLE `cdb_threads` CHANGE `tid` `tid` MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT;</p><p>使用前请备份。(不知道能不能隐藏。怕怕。。)</p><p>
  172. </p></p></p></p></p></p></p>
复制代码

[/micxp_gzhmm]

参加活动:2

组织活动:4

 楼主| being 发表于 2016-1-17 23:25:00 | 显示全部楼层
UPDATE `jiaxobbs`.`ayrdz6000_ds_docinfo` SET `title` =replace('title`,',','-') WHERE `ayrdz6000_ds_docinfo`.`title` LIKE '%,%' limit 1

参加活动:2

组织活动:4

 楼主| being 发表于 2016-1-17 23:28:30 | 显示全部楼层
UPDATE ayrdz6000_ds_docinfo SET `title`=replace(title,',','-') WHERE `docid`='155'UPDATE ayrdz6000_ds_docinfo SET `short`=replace(short,',','-') WHERE `docid`='155'
UPDATE ayrdz6000_ds_docinfo SET `key`=replace(key,',','-') WHERE `docid`='155'

参加活动:1

组织活动:1

jiaxo 发表于 2019-1-10 16:56:16 | 显示全部楼层
UPDATE ayrdz6000_forum_post SET `message`=replace(message,'不错吧','不错') limit 1



UPDATE ayrdz6000_forum_post SET `message`=replace(message,'-','~') WHERE `pid`='29'

参加活动:1

组织活动:1

jiaxo 发表于 2019-4-17 14:37:18 | 显示全部楼层
曹操再奸都有知心朋友,刘备再好都有死对头,所以不要太在乎别人对你的评价,做好自己,干好自己的事,走好自己的路。如此下去,当你牛逼了,朋友自然就会遍天下的。
您需要登录后才可以回帖 登录 | 入住

本版积分规则

客服电话

工作时间 周一至周六 8:00-17:30

客服QQ点击咨询

微信公众号

APP客户端

Copyright © 2006-2018 jiaxo.com All Rights Reserved. 皖ICP备18010636号-3 @jiaxo.com

皖公网安备 34010402701590号

快速回复 返回顶部 返回列表