![]() ![]() Sudo "$MY_SQL_DUMP" -u "$USERNAME" -p"$PASSWORD" -P "$PORT" -host="$HOST" "$DATABASE" > "$DATABASE.sql" Read -p "Enter your Restore-File-Path: " PATHĬat "$PATH.sql" | docker exec -i "$Container" "$MY_SQL_DUMP" -u "$USERNAME" -password="$PASSWORD" "$DATABASE" Read -p "Enter your Container Name or ID: " Containerĭocker exec "$Container" "$MY_SQL_DUMP" -u "$USERNAME" -password="$PASSWORD" "$DATABASE" > "$DATABASE.sql" Read -p "Enter your database Name: " DATABASE Srwxrwxrwx 1 mysql mysql 0 Jan 24 20:28 mysqlx.sock Srwxrwxrwx 1 mysql mysql 0 Jan 24 20:28 mysqld.sock rw-r- 1 mysql mysql 2 Jan 24 20:28 mysqld.pid Mysqld.socket' (2)" when trying to connect "Can't connect to local server through socket '/var/run/mysqd/"Can't connect to local server through socket '/var/run/mysqd/mysqld.socket' (2)" when trying to connect Mysqldump: Got error: 2002: "Can't connect to local server through socket '/var/run/mysqd/mysqld.socket' (2)" when trying to connect sql file will appear in your host folder.ĭocker exec zabbix-docker-62_zabbix-server_1 /usr/bin/mysqldump -u root -password=secret -S /var/run/mysqd/mysqld.socket zabbix > ~/zabbix.dump Since you take a mysql dump, automatically the. home/host_folder_dump:/home/container_folder_dump With pure docker I don't know how to map a volume (never needed since I always worked with docker-compose hahaha) version: '3' I can give you an example with docker-compose.yml. Just map this folder as a volume on you host. sql file INSIDE the container on /home/dump (or whatever folder you want) Have you tried to map a volume to your host?įor example, if you dump the. I think, you may use this command to get the files in host from container: docker cp :/file/path/within/container /host/path/target Seems to dump the file inside the docker container, but I need it on my host. TO DISK D:backupstestDB.bak Tip: Always back up the database to a different drive than the actual database. Normally, when you want to create a MySQL backup, you either have to stop MySQL or issue a read lock on your MySQL tables in order to get a correct backup if. Choose the database you wish to backup, check the appropriate. Customers of MySQL Enterprise Edition can use the MySQL Enterprise Backup product to do physical backups of entire instances or selected databases, tables, or both. Can someone please tell me, how I get the database dump out of the docker container on my host? The commandĭocker exec CONTAINER /usr/bin/mysqldump -u root -password=root DATABASE > backup.sql To backup your MySQL database using phpMyAdmin click on the export link on phpMyAdmin main page.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |