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

PowerShell: Check IP Conflicts of Computers in Active Directory

We have ran into issues where a group of virtual machines living on a DHCP…

How To Copy Folder in Legacy Windows with Long File Names?

$sourceDirectory='D:\SMBSHARE\LONGPATH' $destinationDirectory='\\FILESERVER\LONGPATH' function copyFolderWithLongNames($sourceDirectory,$destinationDirectory){ $sourceParent=split-path $sourceDirectory -parent $sourceChild=split-path $sourceDirectory -leaf $destinationParent=split-path $destinationDirectory -parent $destinationChild=split-path $destinationDirectory…

PowerShell: Generate Report of Users and Computers That Have Not Logged On for X Days

# AccountsNotLoginXDays.ps1# Set days$lastLogonDaysExceeding = 120# Gather Users$daysRange = (get-date).adddays(-$lastLogonDaysExceeding)$users=Get-ADUser -properties * -filter {(enabled -eq…