Last active
October 11, 2023 19:56
-
-
Save coulterpeterson/8157f8cbb0dcd9379654b08abdebf28c to your computer and use it in GitHub Desktop.
List and Export MySQL/mariaDB Databases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Login to find your db name (optional) | |
mysql -u username -p | |
SHOW DATABASES; | |
EXIT; | |
# Export | |
mysqldump -u username -p dbname | gzip > dump.sql.gz | |
# Copy it from server to local (optional) | |
scp -P 22 user@server:/home/user/dump.sql.gz C:\Users\user\Downloads | |
# Import it into your Docker container (very optional) | |
zcat < dump.sql.gz | docker compose exec -T mariadb mariadb -uroot -proot db |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment