Skip to content

Instantly share code, notes, and snippets.

@cam8001
Last active July 21, 2017 17:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save cam8001/9270022 to your computer and use it in GitHub Desktop.
Save cam8001/9270022 to your computer and use it in GitHub Desktop.
A reset & reinstall script for Drupal 8 core development.
#!/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 -e "drop database drupal"
mysql -e "create database drupal"
echo "Removing files created during drupal install. You will be asked for your password, for sudo.\n"
sudo rm -f ./sites/default/settings.php
sudo rm -rf ./sites/simpletest
sudo cp ./sites/default/default.settings.php ./sites/default/settings.php
sudo chmod 777 ./sites/default/settings.php
sudo rm -rf ./sites/default/files
sudo chmod 777 ./sites/default
# Now install a Drupal.
drush si --account-name=admin --account-pass=admin --db-url=mysql://root:root@localhost/drupal -yv
drush en devel simpletest -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment