Code Monkey home page Code Monkey logo

mysql-user-db-creator-bash-script's Introduction

MySQL Database, User/Password Creator

This Script helps you to create a new MySQL database with specific user & password with just a single command.

INSTALL

To install, simply download the script file and give it the executable permission.

curl -0 https://raw.githubusercontent.com/MagePsycho/mysql-user-db-creator-bash-script/master/src/mysql-db-user-creator.sh -o mysql-db-user-creator.sh
chmod +x mysql-db-user-creator.sh

To make it system wide command

sudo mv mysql-db-user-creator.sh /usr/local/bin/mysql-db-user-creator

USAGE

To display help

sudo ./mysql-db-user-creator.sh --help

In General, basic usage

./mysql-db-user-creator.sh [--host="<host-name>"] --database="<db-name>" [--user="<db-user>"] [--pass="<user-password>"]

Notes:

  • The only required parameter is database name.
  • Default parameter values:
Parameter Default Value
host localhost
user same as database name
password randomly generated

And MySQL credentials for new db/user creation will be taken from the MySQL config file ~/.my.cnf (try ~/my.cnf on Windows).
If you don't have one, you can simply create a .my.cnf file in home directory, with

[client]
host=localhost
user=[your-db-user]
password=[your-db-pass]

If ~/.my.cnf doesn't exist, you will be prompted for the root password. For an automated enviroment it's recommended to make use of MySQL config file.

To Create Db along with specified User & Pass (By passing all parameters explicitly)

./mysql-db-user-creator.sh --host=192.168.1.55 --database=new-db-name --user=new-user --pass=some-strong-pass

To Create Db with User & Pass (By passing only required parameter)

./mysql-create-db-user.sh --database=bash_db2

In this case default values will be used for missing parameters (see above)

Output Sample

MySQL DB, User/Password Creator Result Screentshot - MySQL DB, User/Password Creator Result

mysql-user-db-creator-bash-script's People

Contributors

clindbergh avatar magepsycho avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.