
Dumping MySQL that is running in a container
To take a dump of MySQL running in a Kubernetes container, you have to use Kubernetes commands.
The command used to get into a container pod is kubectl exec ~, and you can use that to create a dump.
- Create a dump
kubectl exec -it -n [namespace] [pod name] -- mysqldump -u [username] -p[password] [dbname] > dump.sql - Restore a dump
kubectl exec -it -n [namespace] [pod name] -- mysql -u [username] -p[password] [dbname] < dump.sql
Comments 0
A nickname and a password are required. The same password edits or deletes the comment later. Comments appear after a review.