Backup MySQL Database - Google drive Integration avatar

Backup MySQL Database - Google drive Integration

Try for free

No credit card required

Go to Store
Backup MySQL Database - Google drive Integration

Backup MySQL Database - Google drive Integration

worldunboxer/backup-mysql-database
Try for free

No credit card required

Effortlessly back up your MySQL database with our Apify actor. It securely connects to your database, generates full SQL backups, and stores them on Google Drive, FTP servers, or Apify Key-Value Store. Ensure data safety with seamless storage and sharing options tailored to your needs.

Backup MySQL Database Actor

Easily back up your MySQL database with this Apify actor. It securely connects to your database, performs a full backup, and saves the output in SQL format. This actor supports multiple storage and sharing options, including Apify Key-Value Store, Google Drive, and FTP servers, ensuring your data is safe and accessible.


Overview

This actor:

  1. Connects to a MySQL database using the provided credentials.
  2. Backs up all tables and data from the specified database.
  3. Saves the backup as an SQL file.
  4. Supports multiple storage options, including Apify Key-Value Store, Google Drive, and FTP servers.
  5. Optionally sends the backup to the specified email address.
  6. Retains backups longer than 7 days if configured with Apify Key-Value Store.

Input Parameters

The following input parameters are required to configure the actor:

MySQL Connection Details

  • host (required):

    • Type: string
    • Description: The hostname or IP address of the MySQL server.
  • user (required):

    • Type: string
    • Description: The username for the MySQL database.
  • password (required):

    • Type: string
    • Description: The password for the MySQL user.
  • database (required):

    • Type: string
    • Description: The name of the database to back up.
  • port (optional):

    • Type: integer
    • Description: The port number of the MySQL database. Default is 3306.
    • Prefill: 3306

Backup Sharing Options

  • email (optional):

    • Type: string
    • Description: The email address where the backup will be sent.
  • keyValueStorage (optional):

    • Type: string
    • Description: The Apify Key-Value Store to retain backups for longer than 7 days. Create a new Key-Value Store in the Apify platform if none exists.

Google Drive Integration

  • driveFolderId (optional):
    • Type: string
    • Description: The folder ID of the Google Drive shared folder where the backup will be uploaded.
    • Instructions: Share the folder with backup-mysql-database-apify@generative-ai-model.iam.gserviceaccount.com and assign editor permissions.

FTP Backup Options

  • ftphost (optional):

    • Type: string
    • Description: The hostname or IP address of the FTP server.
  • ftpuser (optional):

    • Type: string
    • Description: The username for the FTP server.
  • ftppassword (optional):

    • Type: string
    • Description: The password for the FTP user.
  • ftpport (optional):

    • Type: integer
    • Description: The port number of the FTP server. Default is 21.
  • ftpsecure (optional):

    • Type: boolean
    • Description: Indicates whether the FTP server supports FTPS (secure protocol). Default is false.

How It Works

  1. Connects to the Database:

    • The actor connects to the MySQL database using the provided credentials.
  2. Queries Tables:

    • It retrieves all table names using the SHOW TABLES command.
  3. Performs Backup:

    • Backs up all tables and their data into an SQL file containing INSERT statements.
  4. Saves Backup:

    • Saves the backup locally and uploads it to the configured storage options.
  5. Shares Backup:

    • Optionally sends the backup via email or uploads it to Google Drive and/or FTP servers.
  6. Key-Value Store Integration:

    • Retains the backup in the Apify Key-Value Store for longer-term storage (if configured).
  7. Closes Connection:

    • Safely terminates the database connection after the backup is completed.

Usage Instructions

Step 1: Configure Input Parameters

Prepare your input JSON as follows:

1{
2  "host": "example.mysql.com",
3  "user": "admin",
4  "password": "securepassword",
5  "database": "example_db",
6  "port": 3306,
7  "email": "backup@example.com",
8  "keyValueStorage": "MyKeyValueStore",
9  "driveFolderId": "1x2y3zExampleFolderID",
10  "ftphost": "ftp.example.com",
11  "ftpuser": "ftp_user",
12  "ftppassword": "ftp_password",
13  "ftpport": 21,
14  "ftpsecure": true
15}

Step 2: Run the Actor

  1. Create an Apify actor and paste the provided input JSON into the input schema.
  2. Execute the actor to initiate the backup process.
  3. Monitor the progress in the Apify console.

Step 3: Access Backup Files

  • Download the SQL backup file from the Apify Key-Value Store.
  • Retrieve it from your Google Drive or FTP server if those options were configured.

Features

  • Multiple Storage Options: Supports Apify Key-Value Store, Google Drive, and FTP.
  • Customizable Settings: Specify email, port numbers, and security protocols.
  • Retention Control: Use Apify Key-Value Store to retain backups for more than 7 days.
  • SQL Output Format: Backups are generated in universally compatible SQL format.

FAQs

  1. What happens if the backup fails?

    • Check the Apify logs for detailed error messages. Common issues include incorrect credentials or insufficient permissions.
  2. Can I back up multiple databases?

    • Currently, this actor supports one database at a time. To back up multiple databases, run the actor separately for each database.
  3. How do I share Google Drive folders?

    • Ensure the folder is shared with backup-mysql-database-apify@generative-ai-model.iam.gserviceaccount.com and assign editor permissions.

Contact and Support

For support or inquiries, contact the developer at: worldunboxer1@gmail.com.


Disclaimer

This actor does not guarantee error-free backups. It is the user's responsibility to verify the integrity and completeness of the backups. Ensure proper configurations and permissions are in place before running the actor.

Developer
Maintained by Community

Actor Metrics

  • 2 monthly users

  • 1 bookmark

  • >99% runs succeeded

  • Created in Jan 2025

  • Modified 20 days ago