How do I restore a dump file from mysqldump using kubernetes?

前端 未结 3 1093
孤城傲影
孤城傲影 2021-01-25 04:07

I know how to restore a dump file from mysqldump. Now, I am attempting to do that using kubernetes and a docker container. The database files are in persistent (nfs) mount. The

3条回答
  •  醉话见心
    2021-01-25 04:34

    This should work:

    kubectl  --kubeconfig=k8s-XXXXXXX-kubeconfig.yaml exec -i ddevdb-XXXXX -- mysql -u root -h mysqlservice -proot drupal < you-dump.sql
    

    kubeconfig is optional, digitalocean for examples provides that so you can run your commands from your local.

    To see if everything looks good:

    kubectl --kubeconfig=k8s-XXXXXXX-kubeconfig.yaml run -it --rm --image=mariadb:10.4 --restart=Never mysql -- mysql -h mysqlservice -proot
    

    After which you'll have a terminal inside mysql.

提交回复
热议问题