Skip to content

Instantly share code, notes, and snippets.

@bhubr
Last active July 23, 2019 15:51
Show Gist options
  • Save bhubr/1abd13a8ae1280ed7272b30b74971ca1 to your computer and use it in GitHub Desktop.
Save bhubr/1abd13a8ae1280ed7272b30b74971ca1 to your computer and use it in GitHub Desktop.
Bash script: create MySQL database + user + grant privileges
#!/bin/bash
mysql -uroot -p -e "create database if not exists $1 character set utf8 collate utf8_general_ci; create user if not exists $2@localhost identified by \"$3\"; grant all privileges on $1.* to $2@localhost; flush privileges;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment