#!/bin/bash service mysql start # Perform the equivalent of running `mysql_secure_installation` mysql -u root << EOF UPDATE mysql.user SET authentication_string=PASSWORD('Password123') WHERE User='root'; DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1'); DELETE FROM mysql.user WHERE User=''; DELETE FROM mysql.db WHERE Db='test' OR Db='test_%'; FLUSH PRIVILEGES; EOF # Setting up the basics mysql -u root << EOF CREATE USER 'web'@'localhost' IDENTIFIED BY 'Password456'; CREATE DATABASE friendbook; GRANT ALL PRIVILEGES ON friendbook . * TO 'web'@'localhost'; FLUSH PRIVILEGES; EOF