Code Monkey home page Code Monkey logo

automatic-mysql-database-backup-to-google-drive's Introduction

Automatic MySQL Database Backup to Google Drive

01 Repo Structure

    ├── docs                                   # Contains documents  
    ├── research                               # Contains pre-research. 
    ├── source                                 # Contains project source code.
    │   ├── main.php                               # Main app file.
    └── README.MD                              # Readme Content.
    └── LICENSE.MD                             # LICENSE of the project.

02 Introduction

This repository contains a PHP script designed for automating MySQL database backups from a hosting server to Google Drive. The script utilizes cron jobs to schedule regular backups, ensuring data integrity and availability. Backups are securely transferred to Google Drive for safekeeping and can be configured to delete older backups to manage storage efficiently.

Key Features:

  • Automated Backup: Schedule backups at regular intervals using cron jobs.
  • Secure Transfer: Safely transfer backups to Google Drive using OAuth for authentication.
  • Storage Management: Option to delete older backups to optimize storage usage.
  • Customizable: Easily configure backup settings and schedule as per your requirements. Usage:

Banner

03 Technology Stack

  • PHP
  • Python
  • google-apiclient:^2.0

04 Setup

  • Step 01: Enable Google Drive API

    • Go to the Google Cloud Console.
    • Create a new project or select an existing project.
    • Enable the Google Drive API.
  • Banner

  • Step 02: Create a service account

    • Navigate to IAM & Admin > Service accounts.
    • Fill in the Service Account Details.
    • Create and Download a JSON Key File.
    • Use the Service Account using JSON Key.
  • Banner

  • Step 03: Create and save JSON Auth Key

    • Navigate to Service accounts > Keys.
    • Select JSON Key and save it (This key is used for authentication purpose).
  • Step 04: Create a folder in Google Drive and share it to service account mail

    • Service Account Mail

    • Banner

    • Share the destination folder to Service Account Mail

    • Banner

  • Step 05: Deploy the script to the server

    • Banner
  • Step 06: Install google-apiclient:^2.0 using composer through SSH

        composer require google/apiclient:^2.0
    
  • Step 07: Update Folder ID & Auth Key JSON file path in the main.php script

  • Banner

  • Step 08: Update credentials in the main.php script

  • Banner

  • Step 09: Hook up this script with cron schedular in the Server

    • Banner

5.2 Output

Output

Contact

Website:

Visit

Social Media:

LinkedIn Facebook WhatsApp Instagram X.COM Kaggle TikTok YouTube

automatic-mysql-database-backup-to-google-drive's People

Contributors

gunarakulangunaretnam avatar

Stargazers

 avatar

Watchers

 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.