PHPackages                             impactwave/mysql-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. impactwave/mysql-tools

ActiveLibrary[CLI &amp; Console](/categories/cli)

impactwave/mysql-tools
======================

Command-line shell scripts for managing MySQL databases on Laravel-based web applications.

1.0.0(4y ago)2244MITShell

Since Jan 28Pushed 4y ago9 watchersCompare

[ Source](https://github.com/Impactwave/mysql-tools)[ Packagist](https://packagist.org/packages/impactwave/mysql-tools)[ RSS](/packages/impactwave-mysql-tools/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

MySQL Tools
===========

[](#mysql-tools)

##### Command-line shell scripts for managing MySQL databases.

[](#command-line-shell-scripts-for-managing-mysql-databases)

### Introduction

[](#introduction)

Backing up, restoring and copying MySQL databases via command-line is not as simple as it should be. Lots of configuration options and edge-cases make you wast time searching for anwers on *Stack Overflow* and require more work than it should. Specially if the server is not on the local network and must be accessed via an SSH tunnel.

This project provides a small set of Bash scripts that make these common operations trivially simple and easy.

> **Note:** branch `laravel` (or any `1.x` version) holds an old version suitable for integration with Laravel projects.
>
> The current version can be used independently of any project or progamming language. You just need **Bash** installed on your system.
>
> It can be installed globally on your computer so that you can use the provided commands independently with any database, local or remote.

Installation
------------

[](#installation)

### Installing standalone

[](#installing-standalone)

Clone the repository somewhere on your computer.

You can then either:

1. copy the files into one of the folders on your PATH, or
2. add the project's directory to your environment's `PATH` variable.

The second option has the added benefit that you may update the tools to the latest version easily by issuing a `git pull` command.

### Installing via Composer

[](#installing-via-composer)

##### To install globally on your system:

[](#to-install-globally-on-your-system)

```
composer global require impactwave/mysql-tools

```

If you haven't done it before, add `~/.composer/vendor/bin` to your path, so that you may execute the scripts from anywhere on your computer.

##### Example:

[](#example)

Add this to your shell environment (ex: at `~/.profile` or `~/.bash_profile`):

```
export PATH=$PATH:./vendor/bin

```

##### To install on your PHP project only

[](#to-install-on-your-php-project-only)

Add the following to our `composer.json` file:

```
"require": {
    "impactwave/mysql-tools": "^2.0"
},

```

Or, if you want the latest development version (not recommended):

```
"require": {
    "impactwave/mysql-tools": "dev-master@dev"
},

```

> **Note:** do not checkout `1.x` versions unless you want the Laravel-specific versions of these tools.

If you haven't done it before, add `vendor/bin` to your path, so that you may execute the scripts from your project's root folder.

Usage
-----

[](#usage)

### mysql-backup

[](#mysql-backup)

```
Backs up a MySQL database with sensible default options. Supports SSH connections to remote servers.

Usage: mysql-backup [options] [ssh://@[:]]
       [:@[:mysql-port]]  []

Parameters:
  ssh-user        Username for the SSH connnection.
                  Note: you must use key-based SSH authentication; there is no option to specify a password.
  ssh-host        Hostname or IP address for the SSH connection.
  ssh-port        Port for SSH connnection. Defaults to 22.
  mysql-user      Username for database connection.
  mysql-pass      Password for database connection.
  mysql-host      Hostname or IP address for direct network connection to MySQL.
  database        Name of the database to be backed up.
  archive_name    Filename with optional path and without extension (.tgz or .sql will be appended).
                  If not specified or if it ends with / (it's a directory name), the backup archive will be named
                  'HOST-YYYY-MM-DD-hhmmss.tgz', where HOST is the target server's host name, YYYY-MM-DD is the current
                  date and hhmmss is the current time.

Options:
  -t ""   Space-delimited list of tables to be backed up (ex: -t "table1 table2").
  -C              Do not compress the backup; the backup file will be an SQL script instead of a compressed archive.
  -D              Do not set DEFINER clauses to the current user (which is done to prevent errors for missing users when
                  the backup is restored).

Notes:
 - if no ssh:// connection argument is provided, a direct connection to MySQL will be performed.
 - if no direct connection argument is provided, defaults will be used (localhost, current system user, current user's pass).
 - if an compressed archive is generated, it will contain a file named '$dumpfile'.
 - if using an SSH connection and -n is specified, the backup file will be copied to the local machine using network
   compression.

```

License
-------

[](#license)

MIT

The MIT License (MIT)

Copyright (c) 2014 Impactwave Lda

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1571d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/750f00fdbb8cb2fd1c11c5c26b512217451bb001ac48a77542efa7123b9e2124?d=identicon)[impactwave](/maintainers/impactwave)

---

Top Contributors

[![claudio-silva](https://avatars.githubusercontent.com/u/1999803?v=4)](https://github.com/claudio-silva "claudio-silva (3 commits)")

### Embed Badge

![Health badge](/badges/impactwave-mysql-tools/health.svg)

```
[![Health](https://phpackages.com/badges/impactwave-mysql-tools/health.svg)](https://phpackages.com/packages/impactwave-mysql-tools)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.1k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)[codedungeon/php-cli-colors

Liven up you PHP Console Apps with standard colors

10210.1M26](/packages/codedungeon-php-cli-colors)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
