Posted On December 20, 2019

Linux: MySql Docker Container – Export database

kimconnect 0 comments
blog.KimConnect.com >> Codes , Linux >> Linux: MySql Docker Container – Export database
# Set Variables
sqlContainer="mysql-server"
userName=brucelee
password=chucknorris
databaseName=kimconnect


# Run mysql inside container
docker exec -it  $sqlContainer mysql -u$userName --password='$password'
show databases;

# Execute mysqldump
docker exec $sqlContainer /usr/bin/mysqldump -u$userName --password='$password' $databaseName | gzip > /var/tmp/$databaseName.sql.gz

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Linux: How to Display the SSL Certificate of a Remote Server URL

Command: server=test.kimconnect.comecho | openssl s_client -showcerts -servername $server -connect $server:443 2>/dev/null | openssl x509 -inform…

PowerShell: Create Daily VSS Snapshot of Volumes on Local Windows Machine

<# Daily-VSS-Snapshot-Windows-Standalone-FileServer.ps1 Functions: 1. Dynamically detect all volumes on local machine 2. Take snapshots of…

Sample Forth Shift Script

REM Daily Batch for Fourth Shiftrem E:\FShift\cabsauto\timeout 14400rem E:\FShift\cabsauto\timeout 7200rem E:\FShift\cabsauto\timeout 7200rem E:\FShift\cabsauto\timeout 7200rem E:\FShift\cabsauto\timeout…