Skip to content

ala-garbaa-pro/AutoDockerMySQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Database Management Shell Script

This is a shell script that allows you to perform various actions on a database using automation with Docker. The script provides an easy-to-use command-line interface to interact with the database.

Prerequisites

Before running this script, ensure that you have Docker installed on your system and the necessary Docker images or containers for the database you want to manage.

Usage

To use this script, follow the instructions below:

./database.sh [ACTION] [PATH]

Replace [ACTION] with one of the following options:

  • c or create: Create a new database.
  • e or export: Export the database.
  • i or import: Import the database from the file specified in [PATH].
  • d or delete: Delete an existing database.
  • r or recreate: Delete the existing database and create a new one.
  • p or print_uri: Print the database URI.
  • ch or check: Check the database connection.

Actions

Create a New Database

To create a new database, run the following command:

./database.sh create

Export the Database

To export the database, use the following command:

./database.sh export

Import the Database

To import the database from a specific file, provide the file PATH as follows:

./database.sh import PATH

Replace PATH with the path to the file containing the database you want to import.

Delete an Existing Database

To delete an existing database, use the following command:

./database.sh delete

Delete and Recreate Database

To delete the existing database and create a new one, use the following command:

./database.sh recreate

Print Database URI

To print the database URI, use the following command:

./database.sh print_uri

Check Database Connection

To check the database connection, use the following command:

./database.sh check

Examples

  1. Create a new database:
./database.sh create
  1. Export the database:
./database.sh export
  1. Import the database from a file:
./database.sh import /path/to/database_file.sql
  1. Delete an existing database:
./database.sh delete
  1. Delete the existing database and create a new one:
./database.sh recreate
  1. Print the database URI:
./database.sh print_uri
  1. Check the database connection:
./database.sh check

Note

  • Make sure to adjust the script according to your specific database configuration and Docker setup.
  • Use the script at your own risk, and ensure you have proper backups before performing any destructive actions.

If you have any questions or face issues, feel free to contact me.

Happy database management! 😄

About

Automated Bash Shell Script for Docker, managing MySQL DB: create, export, import, delete, print URI, check connection

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages