Created
March 15, 2013 14:35
-
-
Save ajmorris/5170263 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printf "MySQL User: " | |
read MYSQLUSER | |
if [ "$MYSQLUSER" = "" ]; then | |
set MYSQLUSER = "root" | |
fi | |
printf "MySQL Password: " | |
read MYSQLPWD | |
if [ "$MYSQLPWD" = "" ]; then | |
set MYSQLPWD = "asdfasdf" | |
fi | |
printf "Database Host: (e.g. 127.0.0.1)" | |
read NEWHOST | |
if [ "$NEWHOST" = "" ]; then | |
set NEWHOST = "127.0.0.1" | |
fi | |
printf "What would you like to name your new database (i.e. newwpdb)?" | |
read NEWDB | |
echo "CREATE DATABASE $NEWDB; GRANT ALL ON $NEWDB.* TO 'root'@'localhost';" | /usr/local/bin/mysql -uroot -pollie1 | |
cp -n ./wp-config-sample.php ./wp-config.php | |
SECRETKEYS=$(curl -L https://api.wordpress.org/secret-key/1.1/salt/) | |
EXISTINGKEYS='put your unique phrase here' | |
printf '%s\n' "g/$EXISTINGKEYS/d" a "$SECRETKEYS" . w | ed -s wp-config.php | |
DBUSER=$"username_here" | |
DBPASS=$"password_here" | |
DBNAME=$"database_name_here" | |
DBHOST=$"localhost" | |
sed -i '' -e "s/${DBUSER}/${MYSQLUSER}/g" wp-config.php | |
sed -i '' -e "s/${DBPASS}/${MYSQLPWD}/g" wp-config.php | |
sed -i '' -e "s/${DBNAME}/${NEWDB}/g" wp-config.php | |
sed -i '' -e "s/${DBHOST}/${NEWHOST}/g" wp-config.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment