{"id":20525549,"url":"https://github.com/code-lts/sql-backup","last_synced_at":"2025-04-14T03:51:28.980Z","repository":{"id":66251418,"uuid":"128431804","full_name":"code-lts/sql-backup","owner":"code-lts","description":"Backup your MySQL/MariaDB server ( structure, data, users, grants, views, triggers, routines, events )","archived":false,"fork":false,"pushed_at":"2024-07-10T10:02:39.000Z","size":95,"stargazers_count":4,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T17:51:45.311Z","etag":null,"topics":["mariadb-backup","mysql-backup","mysqldump","mysqldump-backup","sql-backup"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/code-lts.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-06T18:13:52.000Z","updated_at":"2024-07-10T10:02:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"6815be54-8b5f-43fa-b5cc-1eeeb0233312","html_url":"https://github.com/code-lts/sql-backup","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-lts%2Fsql-backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-lts%2Fsql-backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-lts%2Fsql-backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-lts%2Fsql-backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/code-lts","download_url":"https://codeload.github.com/code-lts/sql-backup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248819353,"owners_count":21166474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mariadb-backup","mysql-backup","mysqldump","mysqldump-backup","sql-backup"],"created_at":"2024-11-15T23:06:08.056Z","updated_at":"2025-04-14T03:51:28.961Z","avatar_url":"https://github.com/code-lts.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sql-backup - Backup your MySQL / MariaDB server !\n\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/1d6a522144ca4169a0c679bd9d299341)](https://www.codacy.com/gh/code-lts/sql-backup/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=code-lts/sql-backup\u0026amp;utm_campaign=Badge_Grade)\n[![Actions Status](https://github.com/code-lts/sql-backup/workflows/Run%20tests/badge.svg)](https://github.com/code-lts/sql-backup/actions)\n[![codecov](https://codecov.io/gh/code-lts/sql-backup/branch/master/graph/badge.svg)](https://codecov.io/gh/code-lts/sql-backup)\n[![License: Unlicense](https://img.shields.io/badge/license-Unlicense-blue.svg)](http://unlicense.org/)\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fcode-lts%2Fsql-backup.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fcode-lts%2Fsql-backup?ref=badge_shield)\n[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1827/badge)](https://bestpractices.coreinfrastructure.org/projects/1827)\n\nBackup your MySQL / MariaDB server ( structure, data, users, grants, views, triggers, routines, events )\n\n## Install\n\n### Clone the repository\n\n```sh\ncurl -L -# -o sql-backup.zip https://github.com/code-lts/sql-backup/archive/refs/tags/v1.2.0.zip\n```\n\n### Unzip file\n\n```sh\nunzip sql-backup.zip\n```\n\n### Move into the directory\n\n```sh\ncd sql-backup-1.2.0/\n```\n\n### Copy the configuration example\n\n```sh\ncp .env.dist .env\n```\n\n### Edit your configuration file\n\n#### Nano\n\n```sh\nnano .env\n```\n\n#### Vi\n\n```sh\nvi .env\n```\n\n### Start backup\n\nExecute this command to start the backup !\n\n```sh\n./backup.sh\n```\n\n## Extras\n\nTo use an external env file in a custom location, example :\n\n```sh\n\nexport BACKUP_CONFIG_ENVFILE=\"/home/myuser/secretbackupconfig.env.txt\"\n\n./backup.sh\n\nunset BACKUP_CONFIG_ENVFILE\n```\n\nYou can use the variables of the env file in the `ON_SUCCESS` variable, example :\n\n```sh\nON_SUCCESS=\"${BACKUP_DIR}/onsuccessscript.sh\"\n```\n\n## Options\n\n| NAME           | DEFAULT VALUE                                                                                                                  | OPTIONAL |\n|----------------|--------------------------------------------------------------------------------------------------------------------------------|----------|\n| BACKUP_DIR     |                                                                                                                                | NO       |\n| MYSQL_HOST     |                                                                                                                                | NO       |\n| MYSQL_USER     |                                                                                                                                | NO       |\n| MYSQL_PASS     |                                                                                                                                | YES      |\n| MYSQL_PORT     | 3306                                                                                                                           | YES      |\n| SKIP_DATABASES |                                                                                                                                | YES      |\n| EXPERT_ARGS    | --default-character-set=utf8 --extended-insert=FALSE --single-transaction --skip-comments --skip-dump-date --hex-blob --tz-utc | YES      |\n| ON_SUCCESS     |                                                                                                                                | YES      |\n| SKIP_OP        |                                                                                                                                | YES      |\n\n\u003e ON_SUCCESS is called on script success\n\n## Example .env\n\n```sh\nBACKUP_DIR=/sql_backup\nMYSQL_HOST=localhost\nMYSQL_USER=root\nMYSQL_PASS=root\nMYSQL_PORT=3306\nSKIP_DATABASES=mysql,sys,information_schema,performance_schema,phpmyadmin\nSKIP_OP=users,grants\n```\n\n## Files\n\n| NAME          | DESCRIPTION                               |\n|---------------|-------------------------------------------|\n| database.sql  | All the data                              |\n| structure.sql | The structure of the databases and tables |\n| grants.sql    | The grants for all users except root      |\n| events.sql    | The scheduled events                      |\n| views.sql     | The views                                 |\n| triggers.sql  | The triggers                              |\n| routines.sql  | All the procedures \u0026 functions            |\n| users.sql     | All MySQL users                           |\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fcode-lts%2Fsql-backup.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fcode-lts%2Fsql-backup?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-lts%2Fsql-backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode-lts%2Fsql-backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-lts%2Fsql-backup/lists"}