Skip to content

Instantly share code, notes, and snippets.

@yanniboi
Created October 3, 2014 14:18
Show Gist options
  • Save yanniboi/c0f1443f735ab894a3b4 to your computer and use it in GitHub Desktop.
Save yanniboi/c0f1443f735ab894a3b4 to your computer and use it in GitHub Desktop.
Reinstall a clean drupal 8 site
#!/bin/sh
# Removes an existing Drupal 8 install, then install again.
# Requires Drush 7 - https://github.com/drush-ops/drush
#
# Run this script from the docroot of a Drupal 8 checkout.
# Installs to mysql://localhost/drupal, user 1 user/pass is admin/admin.
if [ ! -e ./core/core.services.yml ]
then
echo "You need to run this script from the root of a Drupal 8 install."
exit
fi
# MySQL
echo "Dropping and recreating 'drupal' database.\n"
mysql -u user -ppass -e "drop database drupal"
mysql -u user -ppass -e "create database drupal"
echo "Removing files created during drupal install. You will be asked for your password, for sudo.\n"
rm -f ./sites/default/settings.php
rm -rf ./sites/simpletest
cp ./sites/default/default.settings.php ./sites/default/settings.php
rm -rf ./sites/default/files
mkdir ./sites/default/files
chmod 777 -R ./sites/default
# Now install a Drupal.
# Minimal install
#drush si minimal --account-name=admin --account-pass=admin --db-url=mysql://user:pass@localhost/drupal -yv
# Standard install
drush si --account-name=admin --account-pass=admin --db-url=mysql://user:pass@localhost/drupal -yv
drush cr
@yanniboi
Copy link
Author

yanniboi commented Oct 3, 2014

Some commands might need sudo adding to them for permission-y stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment