How to make database dump before closing (mysql) testcontainer #6801
Answered
by
eddumelendez
marceloverdijk
asked this question in
Q&A
-
I'm trying to create mysql dump before closing the container like below:
However it gives me back:
I also tried with
but that gives:
Is mysqldump part of testcontainers or should I call it differently? |
Beta Was this translation helpful? Give feedback.
Answered by
eddumelendez
Apr 6, 2023
Replies: 1 comment 1 reply
-
Sorry for the delay. You should run |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
marceloverdijk
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry for the delay. You should run
container.execInContainer("mysqldump", "-u", container.getUsername(), "--password=" + container.getPassword(), container.getDatabaseName(), "--result-file=dump.sql");
. You don't need the random port because it is running in the mysql instance itself.