Backup MySQL Database avatar

Backup MySQL Database

Under maintenance
Try for free

Pay $1.00 for 1,000 Backups

Go to Store
This Actor is under maintenance.

This Actor may be unreliable while under maintenance. Would you like to try a similar Actor instead?

See alternative Actors
Backup MySQL Database

Backup MySQL Database

worldunboxer/backup-mysql-database
Try for free

Pay $1.00 for 1,000 Backups

This actor connects to a MySQL database, and generates a complete database backup. The output can be saved in JSON or SQL format and is uploaded to the Apify key-value store for easy access. Simply provide the database connection details to get started.

MySQL Database Dump Actor

A private Apify actor that creates backups of MySQL databases and stores them in either JSON or SQL format. This actor connects to your MySQL database, dumps all tables, and saves the output to both a local file and the Apify key-value store.

Features

  • Dumps all tables from a specified MySQL database
  • Supports both JSON and SQL output formats
  • Automatically escapes special characters in SQL output
  • Saves dumps both locally and to Apify key-value store
  • Handles large datasets efficiently
  • Provides detailed logging throughout the process

Input Parameters

The actor accepts the following input parameters:

ParameterTypeRequiredDescription
hoststringYesMySQL database host address
userstringYesMySQL database username
passwordstringYesMySQL database password
databasestringYesName of the database to dump
outputFormatstringNoOutput format ('json' or 'sql'). Defaults to 'sql'

Usage

  1. Create a new task in your Apify account
  2. Set up input parameters:
1{
2    "host": "your-database-host",
3    "user": "your-username",
4    "password": "your-password",
5    "database": "your-database-name",
6    "outputFormat": "sql"
7}
  1. Run the actor

Output

The actor produces two outputs:

  1. A local file named mysql_dump.[json|sql]
  2. A record in the Apify key-value store with the key MYSQL_DUMP

JSON Format Example

1{
2    "table1": [
3        {
4            "id": 1,
5            "name": "Example",
6            "value": 100
7        }
8    ],
9    "table2": [
10        ...
11    ]
12}

SQL Format Example

1-- Dumping data for table: users
2INSERT INTO `users` (id, name, email) VALUES
3(1, 'John Doe', 'john@example.com'),
4(2, 'Jane Smith', 'jane@example.com');

Dependencies

  • apify: Apify SDK for Node.js
  • mysql2: MySQL client for Node.js
  • fs: Node.js file system module
  • path: Node.js path module

Technical Details

The actor performs the following steps:

  1. Initializes the Apify environment
  2. Connects to the specified MySQL database
  3. Retrieves a list of all tables
  4. Dumps data from each table
  5. Converts the data to the specified format (JSON or SQL)
  6. Saves the dump locally and to Apify storage
  7. Closes the database connection
  8. Exits gracefully

Error Handling

The actor includes error handling for:

  • Missing input parameters
  • Database connection issues
  • Data retrieval errors
  • File system operations

Limitations

  • Large databases may require increased memory allocation
  • Binary data types are not fully supported
  • Table structures (CREATE TABLE statements) are not included in SQL dumps

Proprietary Notice

This is a private, proprietary software. All rights reserved. This actor, its source code, and documentation are confidential and proprietary to the owner. No part of this software may be reproduced, distributed, or transmitted in any form or by any means without the prior written permission of the owner.

Security Notice

This actor contains sensitive database operations. Please ensure:

  • Keep all credentials secure
  • Limit access to authorized personnel only
  • Regularly rotate database credentials
  • Monitor usage logs for unauthorized access
Developer
Maintained by Community

Actor Metrics

  • 1 monthly user

  • 1 star

  • >99% runs succeeded

  • Created in Jan 2025

  • Modified 7 minutes ago