This repository offers scripts designed to streamline the process of creating super users for MariaDB or MySQL databases. With just a few prompts, these scripts handle user creation and assign all necessary privileges, enabling the new super user to access the database from a specified IP address. Scripts are available in PHP, Bash, and Python, catering to diverse operational environments.
Utilizing these scripts not only simplifies database user management but also minimizes the risk of manual errors. They're especially handy for developers and database administrators who frequently work with MariaDB and MySQL databases.
Simply choose your preferred scripting language, follow the guidelines provided, and have your super user set up in no time!
This repository contains scripts for creating a super user in MariaDB/MySQL databases. Scripts are provided in 3 languages: Bash, Python and PHP.
- MariaDB/MySQL: Ensure you have MariaDB or MySQL installed and accessible from the command line.
- Bash: For the Bash script, you should be on a UNIX-like system or have Bash installed on Windows (e.g., through WSL).
- Python: For the Python script, ensure you have Python 3 installed.
- PHP: For the PHP script, you need to have PHP CLI installed.
- Save the Bash script as
create_db_user.sh
. - Give it execute permissions:
chmod +x create_db_user.sh
- Run the script:
./create_db_user.sh
- Save the Python script as
create_db_user.py
. - Run the script:
python3 create_db_user.py
- Save the PHP script as
create_db_user.php
. - Run the script:
php create_db_user.php
-
Script Execution: Start by running the
create_db_user.py
script.$ python3 create_db_user.py
Output:
Which database are you using (mariadb/mysql)?
-
Database Choice: Here, provide your choice of database (mariadb or mysql).
mariadb
Output:
Username:
-
Entering Username: Input the username you wish to create.
mysuperuser
Output:
Password:
-
Entering Password: Provide the desired password.
supersecretpassword
Output:
IP Address:
-
IP Address Input: Specify the IP address from which the user can connect.
192.168.1.100
Output:
Operation completed.
For support, issues, or feedback, please open an issue on this repository.
Contributions, issues, and feature requests are welcome. Feel free to check issues page if you want to contribute.