1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
docker run -d --name my-mariadb -e MARIADB_ROOT_PASSWORD=abc123 mariadb:10.10.2 docker exec -it my-mariadb bash // Test connect mysql --help mysql -u root --password=abc123 mysql --host host.docker.internal --port 3306 -u root --password=password mysql --host staging-v22.cxihrjsldwdw.ap-southeast-1.rds.amazonaws.com --port 3306 -u cplstaging --password=cplstagingdeptrai2022XX > SHOW DATABASES; // Backup mysqldump --help ## Dump database adminv3 with table user mysqldump --host staging-v22.cxihrjsldwdw.ap-southeast-1.rds.amazonaws.com --port 3306 -u cplstaging --password=cplstagingdeptrai2022XX adminv3 user > data-dump.sql ## Dump database adminv3 with table user and table migration mysqldump --host staging-v22.cxihrjsldwdw.ap-southeast-1.rds.amazonaws.com --port 3306 -u cplstaging --password=cplstagingdeptrai2022XX adminv3 user migrations > data-dump.sql ## Dump database adminv3 with table admin_action_log and condition mysqldump --host staging-v22.cxihrjsldwdw.ap-southeast-1.rds.amazonaws.com --port 3306 -u cplstaging --password=cplstagingdeptrai2022XX adminv3 admin_action_log --where="created_at > 1669707228000" > data-dump.sql ## Note: use ">> data-dump.sql". It will append the previous dump file. // Restore to database db_admin_backend mysql --host host.docker.internal --port 3306 -u root --password=password db_admin_backend < data-dump.sql |
MySQL and MariaSQL – Backup and Restore
Author: admin - Posted: 15/07/21 - Update: 30/11/22