# 创建数据库 CREATE DATABASE databaseName; CREATE USER username@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON databaseName.* TO username@'localhost'; or # GRANT ALL PRIVILEGES ON databaseName.* TO username@'%' identified by 'password' FLUSH PRIVILEGES;
# 按需打开mariadb远程访问权限 vi /etc/mysql/mariadb.conf.d/50-server.conf # 注释掉下面内容 # bind-address = 127.0.0.1
DELETE FROM wp_comments WHERE comment_type ='order_note'; DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type ='shop_order'); DELETE FROM wp_posts WHERE post_type ='shop_order'; DELETE FROM wp_posts WHERE post_type ='post' and post_author =4; DELETE FROM wp_posts WHERE post_status ='trash';
SELECT* FROM wp_posts WHERE post_type ='page' AND post_status ='publish'; selectcount(1) from wp_posts WHERE post_type ='post' and post_author =4; select* from wp_postmeta where post_id ='1007'
select* from wp_users delete from wp_users where ID =4
select* from wp_options where option_id in (1, 2) select* from wp_posts where guid like'https://surpoutlets.com%' select* from wp_posts where post_content like'%us.surpoutlets.com%' select* from wp_postmeta where meta_value like'%us.surpoutlets.com%'
select* from wp_posts where id ='25482' select* from wp_posts where post_parent ='25482'
DELETE FROM wp_woocommerce_order_itemmeta where1=1; DELETE FROM wp_woocommerce_order_items where1=1;
# 查询价格 select* from wp_options where option_name like'%_transient_wc_var_prices%' and option_name in (selectdistinct concat('_transient_wc_var_prices_', w.post_parent) from wp_posts w join wp_posts w1 on w1.id = w.post_parent where w1.post_type ='product' and w.post_type ='product_variation' and w.guid like'%us.surpoutlets.com%' and w.post_parent ='25482');
# 先查单个产品 select id, post_title from wp_posts where post_type ='product' and post_parent ='0' and guid like'%us.surpoutlets.com%';
# 查询单个产品的价格信息 select* from wp_postmeta where post_id in (select id from wp_posts where post_type ='product' and post_parent ='0' and guid like'%us.surpoutlets.com%' and id notin ('25482')) and meta_key like'%price%' and meta_value !='';
# 再查可变产品 select* from wp_posts w join wp_posts w1 on w1.id = w.post_parent where w1.post_type ='product' and w.post_type ='product_variation' and w.guid like'%us.surpoutlets.com%' and w.post_parent notin ('25482'); # 查询可变产品的价格信息 select* from wp_postmeta where post_id in (select w.id from wp_posts w join wp_posts w1 on w1.id = w.post_parent where w1.post_type ='product' and w.post_type ='product_variation' and w.guid like'%us.surpoutlets.com%' and w.post_parent notin ('25482')) and meta_key like'%price%' and meta_value !=''; # 查询可变产品的价格范围 select* from wp_wc_product_meta_lookup where product_id in (select w.id from wp_posts w join wp_posts w1 on w1.id = w.post_parent where w1.post_type ='product' and w.post_type ='product_variation' and w.guid like'%us.surpoutlets.com%' and w.post_parent notin ('25482'));
update wp_posts set guid = replace(guid, 'https://us.surpoutlets.com', 'https://surpoutlets.com') where guid like'https://us.surpoutlets.com%';
update wp_posts set post_content = replace(post_content, 'https://us.surpoutlets.com', 'https://surpoutlets.com') where post_content like'%https://us.surpoutlets.com%'
update wp_postmeta set meta_value = replace(meta_value, 'us.surpoutlets.com', 'surpoutlets.com') where meta_value like'%us.surpoutlets.com%'
# 批量更新单个产品价格 update IGNORE wp_postmeta set meta_value = round(cast(meta_value asinteger) /20, 0) where post_id in (select id from wp_posts where post_type ='product' and post_parent =0 and guid like'%us.surpoutlets.com%' and id notin ('25482')) and meta_key like'%price%' and meta_value !='';
# 批量更新可变产品价格 update IGNORE wp_postmeta set meta_value = round(cast(meta_value asdecimal) /20, 0) where post_id in (select w.id from wp_posts w join wp_posts w1 on w1.id = w.post_parent where w1.post_type ='product' and w.post_type ='product_variation' and w.guid like'%us.surpoutlets.com%' and w.post_parent notin ('25482')) and meta_key like'%_price%' and meta_value !='';
# 可变产品需要更新价格区间 update ignore wp_wc_product_meta_lookup set min_price = round(cast(min_price asdecimal) /20, 0), max_price = round(cast(max_price asdecimal) /20, 0) where product_id in (select w.id from wp_posts w join wp_posts w1 on w1.id = w.post_parent where w1.post_type ='product' and w.post_type ='product_variation' and w.guid like'%us.surpoutlets.com%' and w.post_parent notin ('25482')); #删除可变产品的价格区间缓存 delete from wp_options where option_name in (selectdistinct concat('_transient_wc_var_prices_', w.post_parent) from wp_posts w join wp_posts w1 on w1.id = w.post_parent where w1.post_type ='product' and w.post_type ='product_variation' and w.guid like'%us.surpoutlets.com%' and w.post_parent notin ('25482'));