Skip to content

Instantly share code, notes, and snippets.

@mattbell87
mattbell87 / create-mysql.bash
Last active May 7, 2024 01:07 — forked from omeinusch/create-mysql.bash
Simple bash script to create mysql db, user with generated password
#!/bin/bash
echo "Creating MySQL user and database"
PASS=$2
if [ -z "$2" ]; then
PASS=`openssl rand -base64 8`
fi
mysql -u root <<MYSQL_SCRIPT
CREATE DATABASE $1;
CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS';