按欄目統計所有文章的訪問量
selectsum(meta_value) from `wp_postmeta` where post_id in (select id from `wp_posts` where id in (select
object_id
from `wp_term_relationships` where `term_taxonomy_id` =
'欄目的id
') and post_status =
'publish
') and meta_key =
'views
'
批量刪除文章修訂
deletefrom wp_posts where post_type = "revision";
delete'0';
手動重設密碼
update wp_users set user_pass = md5('password
') where wp_users.user_login =
'admin
';
更改wordpress的網域名稱
update wp_options setoption_value
=replace(option_value, '
', '
')where option_name =
'home
'or option_name =
'siteurl';
update wp_options set
option_value
=replace(option_value, '
', '
')where option_name =
'home
'or option_name =
'siteurl';
update wp_posts set
post_content
=replace(post_content, '
', '
');
update wp_options set option_value =replace(option_value, '
http://www.舊**.com
','http://www.新**.com
') where option_name =
'home
'or option_name =
'siteurl
'
update wp_posts set guid =replace (guid, '
http://www.舊**.com
', '
http://www.新**.com
')
修改文章作者
update wp_posts set post_author ='b'where post_author ='a
'
重設admin的使用者名稱
update wp_users set user_login ='新的使用者名稱
'where user_login =
'admin
'
手動重設密碼
update wp_users set user_pass = md5('password
') where wp_users.user_login =
'使用者名稱
' limit 1;
批量刪除文章修訂
wordpress2.6以後的版本增加了乙個post revisions功能,就是為文章增加版本修訂。雖然這個功能有點用,但文章修訂增加了資料庫的大小,我們可以選擇批量刪除。
deletea,b,c
from
wp_posts a
left
join wp_term_relationships b on (a.id = b.object_id
)left
join wp_postmeta c on (a.id =
c.post_id)
where a.post_type =
'revision
'
刪除所有未使用的標籤
deletea,b,c
from wp_terms as
aleft
join wp_term_taxonomy as c on a.term_id =
c.term_id
left
join wp_term_relationships as b on b.term_taxonomy_id =
c.term_taxonomy_id
where c.taxonomy =
'post_tag
'and c.count
=0
刪除所有的pingback
deletefrom
wp_comments
where comment_type =
'pingback
'
deletefrom
wp_comments
'spam
'
updatewp_posts
set comment_status =
'closed
'where post_date <
'2009-01-01
'and post_status =
'publish
'
updatewp_comments
set comment_author_url =
replace( comment_author_url, '
http://舊**.com
', '
http://新**.com
' )
updatewp_posts
set comment_status = 『open
』where post_status = 『publish』;
清理wp_postmeta表
deletefrom wp_postmeta where meta_key =
『_wp_old_slug』;
delete
from wp_postmeta where meta_key = 『_revision-
control』;
delete
from wp_postmeta where meta_value = 『}』;
wordpress 常用 資料庫指令碼
按欄目統計所有文章的訪問量 select sum meta value from wp postmeta where post id in select id from wp posts where id in select object id from wp term relationships ...
初識WordPress資料庫
wordpress由乙個簡單的部落格平台起步,歷經十餘年,演變為乙個被眾多新手和專家樂於使用的內容管理系統,甚至很多高階 也是基於此平台建設,它能整合和實現幾乎你能想到的絕大數功能。最大的優點是wordpress的安裝 配置 資料庫的建立等,不需要使用者具備程式設計知識或者基礎理論。但是,有些時候你...
wordpress資料庫跨庫轉移
背景 wordpress安裝時資料庫指定不正確,導致 上的資料都放到了mysql這個系統庫中。mysql show tables from mysql tables in mysql columns priv db event func general log help category help ...