Skip to content

Instantly share code, notes, and snippets.

@rojenzaman
Last active October 2, 2020 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rojenzaman/5c6a66598a6149b8a795943830e27a90 to your computer and use it in GitHub Desktop.
Save rojenzaman/5c6a66598a6149b8a795943830e27a90 to your computer and use it in GitHub Desktop.
with mysql root
#!/bin/bash
if [ "$#" -lt 4 ]; then
echo "`basename $0` <mysql-root-passwd> <db user> <ip> <db password>";
exit 1;
fi
mysql --user=root --password=$1 <<EOF
CREATE DATABASE wordpress;
CREATE USER '$2'@'$3' IDENTIFIED BY '$4';
GRANT ALL PRIVILEGES ON wordpress.* TO '$2'@'$3';
exit
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment