New MariaDB is a bash script that automates the creation of a new database and user in MariaDB. It simplifies the process by prompting for necessary credentials and applying appropriate privileges.
Features
- Creates a new MariaDB database.
- Creates a new user and assigns privileges.
- Ensures database and user creation only if they do not already exist.
- Secure password handling during input.
Requirements
Before running the script, ensure that:
- You have MariaDB installed and running.
- You have administrative access to MariaDB.
- You have sudo privileges if necessary.
Usage
Run the script with an admin username as an argument:
./new-mariadb.sh -u <admin_user> -p
Example:
./new-mariadb.sh -u root -p
During execution, you will be prompted for:
- Admin password (for authentication)
- New Database Name
- New Username
- New Password (entered securely)
Important Notes
- The script ensures that the database and user are created only if they do not already exist.
- User credentials are entered securely and not exposed in the command line
Get the Script
Categories: Scripts