Last active
March 8, 2023 17:32
-
-
Save neogeogre/a92032c4b729348f66146b683942a188 to your computer and use it in GitHub Desktop.
run pg_dump from docker image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -it \ | |
--user $(id -u):$(id -g) \ | |
-v ~/Desktop:/tmp \ | |
mysql:5.7.37 /bin/bash -c \ | |
"mysqldump -h hostname -u username -p databasename table1 table2 --port 3306 > /tmp/dumpfile.sql" | |
# https://stackoverflow.com/questions/44015692/access-denied-you-need-at-least-one-of-the-super-privileges-for-this-operat | |
grep -n @@SESSION. myDB.sql | |
sed -i '18d' myDB.sql | |
docker run -it \ | |
--user $(id -u):$(id -g) \ | |
-v ~/Desktop:/tmp \ | |
mysql:5.7.37 /bin/bash -c \ | |
"mysql -h mydomain.com -u myUser -p myDb --port 3306 < /tmp/mydump.sql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -it \ | |
--user $(id -u):$(id -g) \ | |
-v ~/Desktop:/tmp \ | |
postgres:12.8 /bin/bash -c \ | |
"pg_dump -h myhost.com -p 5432 -U myUser -W -v myDb > /tmp/myDb.sql" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment