Skip to content

Instantly share code, notes, and snippets.

@nielsenrc
Last active May 3, 2016 21:33
Show Gist options
  • Save nielsenrc/47a22ad64bedc3e5867a45f767947558 to your computer and use it in GitHub Desktop.
Save nielsenrc/47a22ad64bedc3e5867a45f767947558 to your computer and use it in GitHub Desktop.
Wordpress | Command Line Cheatsheet
#Create database
create database [database name];
#Grant permissions and create users
grant select, update, insert, create, delete on [database].* to [user];
#Set password for user
set password for [user] = password('');
#Flush Privileges
flush privileges
#Update database defined URLS
update wp_options set option_value = "[url]" WHERE option_name = "home";
update wp_options set option_value = "[url]" WHERE option_name = "siteurl";
#Set blog public from commandline:
update wp_options set option_value = "1" WHERE option_name = "blog_public";
#Sweep for URLS in content
UPDATE wp_posts SET post_content = REPLACE(post_content,'find','replace');
UPDATE wp_posts SET guid = REPLACE(guid,'find','replace');
#Generic Meta Sweep - use with caution can screw up serialized data
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value,'','');
#Options Sweep
UPDATE wp_options SET option_value = REPLACE(option_value,'find','replace');
#DBMAP in cPanel
/usr/local/cpanel/bin/setupdbmap
#Sweep File Permissions
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment