Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Database backup? #198

Open
timatidg opened this issue Jun 20, 2024 · 2 comments
Open

Suggestion: Database backup? #198

timatidg opened this issue Jun 20, 2024 · 2 comments

Comments

@timatidg
Copy link

I take advantage of the wonderful CV commands available when doing an CiviCRM upgrade, but I don't know of any way to use the command line to read the database information from settings.php and back up the mySQL database. (I have to update a whole bunch of sites and, if this existed, it would mean I would not have to look up each site's details manually, but could just use the same command on all sites.)

I researched if this feature exists anywhere, and I can't find anything. I wish I had the skills to code it and help, but I don't.

@colemanw
Copy link
Member

Sorry this command doesn't currently exist. You may be interested to follow this discussion: https://lab.civicrm.org/dev/core/-/issues/5277

@MegaphoneJon
Copy link
Contributor

This conversation may be more relevant: #191

There's lots of times to backup a db that aren't related to portability - e.g. I back up the db before an upgrade.

My MySQL credentials are stored in a pass repo that my Ansible uses for lookup. But you could use cv vars:show and jq to do this:

PASS=`cv vars:show | jq -r '.["CIVI_DB_PASS"]'`; USER=`cv vars:show | jq -r '.["CIVI_DB_USER"]'`; NAME=`cv vars:show | jq -r '.["CIVI_DB_NAME"]'`; mysqldump -u$USER -p$PASS $NAME > backup.sql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants