Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nelson6e65/bash-mysql-helper
Import, export and make backups of MySQL/MariaDB databases using .env file
https://github.com/nelson6e65/bash-mysql-helper
backups bash basher database dotenv env gzip laravel mariadb mariadb-databases mysql mysql-helper mysqldump sql
Last synced: 10 days ago
JSON representation
Import, export and make backups of MySQL/MariaDB databases using .env file
- Host: GitHub
- URL: https://github.com/nelson6e65/bash-mysql-helper
- Owner: nelson6e65
- License: mit
- Created: 2019-02-19T09:11:37.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-23T14:57:11.000Z (over 4 years ago)
- Last Synced: 2024-11-24T01:42:05.816Z (2 months ago)
- Topics: backups, bash, basher, database, dotenv, env, gzip, laravel, mariadb, mariadb-databases, mysql, mysql-helper, mysqldump, sql
- Language: Shell
- Homepage:
- Size: 23.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mysql-helper
Import, export and make backups of MySQL/MariaDB databases.
## Installing
### Easy with [Basher](https://github.com/basherpm/basher)
```sh
basher install nelson6e65/bash-mysql-helper
```
Done!### Configuring
`mysql-helper` uses a `.env` file to read database credentials.
Example of a `.env` file content:
```sh
# Optional
DB_HOST='localhost'
DB_PORT=3306# Mandatory
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=# Other stuffs not used by `mysql-helper`...
```## Usage
### Backup Database
It creates a backup file: `{database}_{date}.sql.gz` file.
```sh
mysql-helper b
mysql-helper backup
```You can ignore backup creation by using `--no-backup`
### Exporting Database to SQL
Exports DB to `{database}.sql` file.
```sh
mysql-helper e
mysql-helper export
# mysql-helper -e # DEPRECATED
# mysql-helper --export # DEPRECATED
```### Importing SQL to Database
Import a database content from `{database}.sql` file.
```sh
mysql-helper i
mysql-helper import
# mysql-helper -i # DEPRECATED
# mysql-helper --import # DEPRECATED
```> Note: By default it will run `backup` automatically. To avoid this, pass `--no-auto-backup`.
### Customize target dir
By default, it will use the working directory to search files. In order to use a different target-dir:
```sh
mysql-helper (i|e|b)
mysql-helper (i|e|b) --target # DEPRECATED
```### More options
Use --help to see more options.
```sh
mysql-helper --help
```## Credits
Some tools used:
- https://github.com/matejak/argbash