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

GPO Logon Banner

Update: this information is outdated. Use this link for the current method of creating Logon…

PowerShell: Obtain Domain Admin Credential and Save It as an XML for Subsequent Execution

Working Version: # Initialize with defaults$credFileExists=$False# This function is a workaround to the issue of…

PowerShell: Deleting a Single File Safely

# Name your file$item="\\FILESHERVER007\someweird folder names with long paths\ fmmkklghhbb-yj-yuyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy p-hphlfiles\whatup.exe - Shortcut.lnk" #item could…