Skip to content

whitehathackerpr/Database-Management-Tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Database Management Tool

A simple shell script to automate common database tasks such as backing up and restoring a database. Supports both MySQL and PostgreSQL.

Features

  • Backup: Automatically create timestamped SQL backup files.
  • Restore: Restore your database from a specified backup file.
  • Configurable: Easily switch between MySQL and PostgreSQL via config.sh.

Folder Structure

Database-Management-Tool/ ├── db_manager.sh # Main script for backup and restore operations ├── config.sh # Configuration file with database credentials and settings ├── backups/ # Directory for storing backup files (created automatically) └── README.md # Project documentation

ruby Copy Edit

Configuration

  1. Open config.sh and update the following parameters:
    • DB_TYPE: Set to mysql or postgres.
    • DB_NAME: Your database name.
    • DB_USER: Your database username.
    • DB_PASSWORD: Your database password.
    • DB_HOST: Typically localhost.
    • DB_PORT: Default is 3306 for MySQL or 5432 for PostgreSQL.
    • BACKUP_DIR: Directory where backups will be stored.

Installation

  1. Clone the repository:
    git clone https://github.com/yourusername/Database-Management-Tool.git
    cd Database-Management-Tool

Update the configuration: Modify config.sh with your database details.

Make the script executable:

bash Copy Edit chmod +x db_manager.sh Usage Backup Your Database Run the script with the backup command:

bash Copy Edit ./db_manager.sh backup A timestamped SQL backup file will be created in the backups/ directory.

Restore Your Database Run the script with the restore command followed by the path to the backup file:

bash Copy Edit ./db_manager.sh restore backups/your_backup_file.sql License This project is licensed under the MIT License.

yaml Copy Edit


Next Steps

  • Enhancements:
    • Add support for additional database types.
    • Integrate email notifications on backup success or failure.
    • Improve error handling and logging.

This Database Management Tool provides an automated way to backup and restore your databases and can be easily integrated into scheduled cron jobs for regular maintenance. Let me know if you'd like to move on to the next project or need additional features!

About

A simple shell script to automate common database tasks such as backing up and restoring a database. Supports both MySQL and PostgreSQL.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages