Home » TechNote » Shell script to create database & database user interactively

Shell script to create database & database user interactively

When you manage multiple sites, you find yourself in need of having a tool/command line script to quickly create database.

Due to the fact that we often create 1 database user <-> 1 database, for the sake of convenience and security, so the needed script will:

  • Create database
  • Create database user
  • Grant privileges
  • (Optional, needed) Flush privileges
I decided that Shell script is the most suitable for my need, and wrote my own script that is capable for whole of my needs:

Usage:

Full & updated shell script can be found here

Tagged width:, ,