Kubernetes Views 4

Dumping MySQL from a Kubernetes container

Dumping MySQL from a Kubernetes container image 1

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

Reactions

Comments 0

A nickname and a password are required. The same password edits or deletes the comment later. Comments appear after a review.

Comments appear after a review. The password is used again to edit or delete.