%3CLINGO-SUB%20id%3D%22lingo-sub-856279%22%20slang%3D%22en-US%22%3ERe%3A%20Backup%20Azure%20Database%20for%20MySQL%20to%20a%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-856279%22%20slang%3D%22en-US%22%3E%3CH1%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%20id%3D%22toc-hId-2012966717%22%3E%3CSTRONG%3EBackup%20Azure%20Database%20for%20MySQL%3C%2FSTRONG%3E%3C%2FH1%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E---%20backup%20single%20database%3A%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CEM%3Emysqldump%20-Fc%20-v%20-h%20XXXXXXX.mysql.database.azure.com%20-u%20XXXXXXX%20-p%20-d%20databaseName1%20%26gt%3B%20databaseName1_backup.sql%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3E%3CSTRONG%3E---%20backup%20multiple%20database%3A%3C%2FSTRONG%3E%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3Emysqldump%20-Fc%20-v%20-h%20XXXXXXX.mysql.database.azure.com%20-u%20XXXXXXX%20-p%26nbsp%3B%20--databases%20db1%20db2%20db3%26nbsp%3B%20%26gt%3B%20databases-backup.sql%3CBR%20%2F%3E%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CSTRONG%3E---%20backup%20all%20databases%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CEM%3Emysqldump%20-Fc%20-v%20-h%20XXXXXXX.mysql.database.azure.com%20-u%20XXXXXXX%20-p%20--all-databases%20%26gt%3B%20all_databases_backup.sql%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EIf%20you%20see%20issue%20%22mysqldump%3A%201044%20Access%20denied%20when%20using%20LOCK%20TABLES%22%20Or%3CBR%20%2F%3E%22Access%20denied%20for%20use%20'%40'%25'%20to%20database%20'mysql'%20when%20using%20LOCK%20TABLES%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20quick%20workaround%20is%20to%20pass%20the%20%E2%80%93-single-transaction%20option%20to%20mysqldump%3A%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E%3CEM%3Emysqldump%20-Fc%20-v%20-h%20XXXXXXX.mysql.database.azure.com%20-u%20XXXXXXX%20-p%20--single-transaction%20--all-databases%20%26gt%3B%20all_databases_backup.sql%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3Eref%3A%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2F%3C%2FA%3E%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1010309%22%20slang%3D%22en-US%22%3ERe%3A%20Backup%20Azure%20Database%20for%20MySQL%20to%20a%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1010309%22%20slang%3D%22en-US%22%3E%3CP%3Ehow%20can%20we%20restore%20it%20to%20our%20new%20paaS%20Database%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1011885%22%20slang%3D%22en-US%22%3ERe%3A%20Backup%20Azure%20Database%20for%20MySQL%20to%20a%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1011885%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F385037%22%20target%3D%22_blank%22%3E%40Ops_Biren%3C%2FA%3E%26nbsp%3B%2C%20thanks%20for%20your%20comment%2C%20restore%20from%20Azure%20Blog%20Storage%20should%20be%20similar%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1-%20Navigate%20to%20your%20Azure%20Database%20for%20MySQL%20server%20on%20the%20portal%20and%20Run%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcloud-shell%2Fquickstart%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Cloud%20Shell%20(Bash).%26nbsp%3B%26nbsp%3B%3C%2FA%3EIf%20you%20run%20this%20for%20the%20first%20time%20it%20will%20ask%20you%20to%20create%20a%20Storage%20container%20and%20and%20this%20will%20mount%20an%20Azure%20File%20in%20it.%3C%2FP%3E%0A%3CP%3E2-%20Type%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%3CEM%3Edf%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSTRONG%3Ein%20the%20cloud%20shell%20and%20collect%20the%20Azure%20File%20path%3C%2FP%3E%0A%3CP%3E3-%20Change%20directory%20to%20the%20cloud%20drive%20using%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%3CEM%3Ecd%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSTRONG%3Ecommand%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bin%20the%20example%20below%20I%20used%26nbsp%3B%3CEM%3Ecd%20%2Fusr%2Fbashar%2Fclouddrive%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E4-%20Now%20that%20you%20are%20in%20that%20directory%20run%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CEM%3E%3CSTRONG%3Emysql%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FEM%3Ecommand%2C%20%3CBR%20%2F%3Eexample%3A%26nbsp%3B%3CSPAN%3Emysql%20-h%20mydemoserver.mysql.database.azure.com%20-u%20myadmin%40mydemoserver%20-p%20testdb%20%26lt%3B%20testdb_backup.sql%3CBR%20%2F%3E%3CBR%20%2F%3Eref%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fconcepts-migrate-dump-restore%23restore-your-mysql-database-using-command-line-or-mysql-workbench%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fmysql%2Fconcepts-migrate-dump-restore%23restore-your-mysql-database-using-command-line-or-mysql-workbench%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1449910%22%20slang%3D%22en-US%22%3ERe%3A%20Backup%20Azure%20Database%20for%20MySQL%20to%20a%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1449910%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%20for%20the%20useful%20article.%20It%20looks%20like%20this%20method%20leverages%20the%20cloud%20storage%20that%20is%20created%20when%20you%20run%20code%20from%20Azure%20Cloudshell.%20I'd%20like%20to%20run%20this%20remotely%20from%20something%20like%20Azure%20Automation%20on%20a%20regular%20schedule.%20Is%20there%20a%20way%20to%20use%20this%20same%20method%20without%20leveraging%20Azure%20Cloud%20Shell%20storage%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1727468%22%20slang%3D%22en-US%22%3ERe%3A%20Backup%20Azure%20Database%20for%20MySQL%20to%20a%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1727468%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F288088%22%20target%3D%22_blank%22%3E%40Bashar-MSFT%3C%2FA%3E%26nbsp%3BPlease%20have%20the%20image%20corrected%20and%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F287160%22%20target%3D%22_blank%22%3E%40hmikhan%3C%2FA%3E%26nbsp%3Byour%20comment%20updated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20mysqldump%2C%20-d%20option%20is%20not%20used%20to%20specify%20database%20name.%26nbsp%3B-d%2C%20--no-data%20No%20row%20information.%20This%20is%20used%20to%20take%20a%20dump%20of%20the%20database%20without%20any%20data.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-B%20is%20the%20option%20that%20should%20be%20used.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1787549%22%20slang%3D%22en-US%22%3ERe%3A%20Backup%20Azure%20Database%20for%20MySQL%20to%20a%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1787549%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F288088%22%20target%3D%22_blank%22%3E%40Bashar-MSFT%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EMay%20I%20know%20what%20-Fc%20and%20-v%20are%20for%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1791368%22%20slang%3D%22en-US%22%3ERe%3A%20Backup%20Azure%20Database%20for%20MySQL%20to%20a%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1791368%22%20slang%3D%22en-US%22%3E%3CDIV%20class%3D%22lia-message-author-with-avatar%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F834879%22%20target%3D%22_blank%22%3E%40amritav%3C%2FA%3E%26nbsp%3BPlease%20use%20the%20command%20mysqldump%20--help%20to%20learn%20about%20all%20the%20options%3C%2FDIV%3E%0A%3CDIV%20class%3D%22lia-message-author-with-avatar%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%20class%3D%22lia-message-author-with-avatar%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B-F%2C%20--flush-logs%20Flush%20logs%20file%20in%20server%20before%20starting%20dump.%20Note%20that%20if%20you%20dump%20many%20databases%20at%20once%20(using%20the%20option%20--databases%3D%20or%20--all-databases)%2C%20the%20logs%20will%20be%20flushed%20for%20each%20database%20dumped.%20The%20exception%20is%20when%20using%20--lock-all-tables%20or%20--master-data%3A%20in%20this%20case%20the%20logs%20will%20be%20flushed%20only%20once%2C%20corresponding%20to%20the%20moment%20all%20tables%20are%20locked.%20So%20if%20you%20want%20your%20dump%20and%20the%20log%20flush%20to%20happen%20at%20the%20same%20exact%20moment%20you%20should%20use%20--lock-all-tables%20or%20--master-data%20with%20--flush-logs.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-c%2C%20--complete-insert%3A%20Use%20complete%20insert%20statements.%3C%2FP%3E%0A%3CP%3E-v%2C%20--verbose%20Print%20info%20about%20the%20various%20stages.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1791372%22%20slang%3D%22en-US%22%3ERe%3A%20Backup%20Azure%20Database%20for%20MySQL%20to%20a%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1791372%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F814306%22%20target%3D%22_blank%22%3E%40dhruvraj%3C%2FA%3E%26nbsp%3BThanks%20sir%2C%20I%20fixed%20the%20screenshot.%20much%20appreciate%20your%20feedback%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1791374%22%20slang%3D%22en-US%22%3ERe%3A%20Backup%20Azure%20Database%20for%20MySQL%20to%20a%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1791374%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F81293%22%20target%3D%22_blank%22%3E%40Joel%20Hazelton%3C%2FA%3E%26nbsp%3B%20Sorry%20for%20the%20delayed%20response%2C%20please%20take%20a%20look%20at%20this%20blog%20post%3A%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Ftechcommunity.microsoft.com%252Ft5%252Fazure-database-for-mysql%252Fsteps-to-automate-backups-of-your-azure-database-for-mysql%252Fba-p%252F1791157%26amp%3Bdata%3D04%257C01%257CBashar.Hussein%2540microsoft.com%257Ce9c74b2e385b4b7081c808d872337a98%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637384912769118668%257CUnknown%257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%253D%257C1000%26amp%3Bsdata%3DnJU7kjdI8VgXdGqYZ%252FISAm%252FGcGIIMWzCTKaNcCg7950%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-database-for-mysql%2Fsteps-to-automate-backups-of-your-azure-database-for-mysql%2Fba-p%2F1791157%3C%2FA%3E%3C%2FP%3E%0A%3CDIV%20class%3D%22lia-message-author-avatar%20lia-component-author-avatar%20lia-component-message-view-widget-author-avatar%20UserAvatarWrapper%22%3E%0A%3CDIV%20class%3D%22UserAvatarWrapper%22%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CDIV%20class%3D%22lia-message-author-with-avatar%22%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-803830%22%20slang%3D%22en-US%22%3EBackup%20Azure%20Database%20for%20MySQL%20to%20a%20Blob%20Storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-803830%22%20slang%3D%22en-US%22%3E%3CDIV%20class%3D%22lia-message-subject-wrapper%20lia-component-subject%20lia-component-message-view-widget-subject-with-options%22%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3EOften%20customers%20want%20to%20backup%20Azure%20Database%20for%20MySQL%20to%20a%20Blob%20storage.%26nbsp%3B%3CSTRONG%3E%3CEM%3Emysqldump%3C%2FEM%3E%3C%2FSTRONG%3Eutility%20can't%20directly%20write%20the%20output%20file%20on%20a%20Blob%20Storage%2C%20in%20this%20post%20I%20will%20explain%20how%20this%20can%20be%20done%20using%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20style%3D%22font-family%3A%20inherit%3B%20background-color%3A%20%23ffffff%3B%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fstorage%2Ffiles%2Fstorage-files-introduction%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Files%3C%2FA%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E.%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%20class%3D%22lia-message-body-wrapper%20lia-component-message-view-widget-body%22%3E%0A%3CDIV%20id%3D%22bodyDisplay%22%20class%3D%22lia-message-body%22%3E%0A%3CDIV%20class%3D%22lia-message-body-content%22%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1-%20Navigate%20to%20your%20Azure%20Database%20for%20MySQL%20server%20on%20the%20portal%20and%20Run%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcloud-shell%2Fquickstart%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Cloud%20Shell%20(Bash).%26nbsp%3B%26nbsp%3B%3C%2FA%3EIf%20you%20run%20this%20for%20the%20first%20time%20it%20will%20ask%20you%20to%20create%20a%20Storage%20container%20and%20and%20this%20will%20mount%20an%20Azure%20File%20in%20it.%3C%2FP%3E%0A%3CP%3E2-%20Type%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%3CEM%3Edf%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSTRONG%3Ein%20the%20cloud%20shell%20and%20collect%20the%20Azure%20File%20path%3C%2FP%3E%0A%3CP%3E3-%20Change%20directory%20to%20the%20cloud%20drive%20using%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%3CEM%3Ecd%3C%2FEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSTRONG%3Ecommand%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3Bin%20the%20example%20below%20I%20used%26nbsp%3B%3CEM%3Ecd%20%2Fusr%2Fbashar%2Fclouddrive%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E4-%20Now%20that%20you%20are%20in%20that%20directory%20run%20%3CEM%3E%3CSTRONG%3Emysql%3C%2FSTRONG%3E%3C%2FEM%3Ecommand%20to%20extract%20the%20backup%20dump%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mysqldump.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F227321iE87C1305AA56BEDA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22mysqldump.png%22%20alt%3D%22mysqldump.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E5-%20Backup%20file%20is%20ready%20and%20in%20this%20example%20it%20is%20under%20File%20System%20%22%3CEM%3Ecs47e4f0dddd931x4619xbf7%3C%2FEM%3E%22%2C%20navigate%20on%20the%20Azure%20Portal%20to%20that%20file%20system%2C%20as%20in%20the%20following%20screenshot.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22file%20system.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F126901i8A1B72792DC35CC8%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22file%20system.jpg%22%20alt%3D%22file%20system.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E6-%20Download%20backup%20file%20if%20needed%20or%20alternatively%20move%20it%20to%20Blob%20Storage%20using%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fstorage%2Fcommon%2Fstorage-use-azcopy-v10%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzCopy%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FA%3Eutility%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MySQLbackup.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F126902i7CEC0638707D35DE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22MySQLbackup.jpg%22%20alt%3D%22MySQLbackup.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENote%3A%20this%20technique%20leverages%20the%20cloud%20shell%20storage%2C%20if%20you%20are%20interested%20in%20extracting%20the%20dump%20to%20another%20blob%20storage%20please%20check%20the%20steps%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-database-for-mysql%2Fsteps-to-automate-backups-of-your-azure-database-for-mysql%2Fba-p%2F1791157%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-database-for-mysql%2Fsteps-to-automate-backups-of-your-azure-database-for-mysql%2Fba-p%2F1791157%3C%2FA%3E%3C%2FP%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%3C%2FLINGO-BODY%3E
Microsoft
Often customers want to backup Azure Database for MySQL to a Blob storage. mysqldump utility can't directly write the output file on a Blob Storage, in this post I will explain how this can be done using Azure Files.

 

1- Navigate to your Azure Database for MySQL server on the portal and Run Azure Cloud Shell (Bash).  If you run this for the first time it will ask you to create a Storage container and and this will mount an Azure File in it.

2- Type df in the cloud shell and collect the Azure File path

3- Change directory to the cloud drive using the cd command
     in the example below I used cd /usr/bashar/clouddrive

4- Now that you are in that directory run mysql command to extract the backup dump

mysqldump.png

5- Backup file is ready and in this example it is under File System "cs47e4f0dddd931x4619xbf7", navigate on the Azure Portal to that file system, as in the following screenshot.

file system.jpg

6- Download backup file if needed or alternatively move it to Blob Storage using AzCopy utility

MySQLbackup.jpg

 

Note: this technique leverages the cloud shell storage, if you are interested in extracting the dump to another blob storage please check the steps here: https://techcommunity.microsoft.com/t5/azure-database-for-mysql/steps-to-automate-backups-of-your-az...

9 Comments
Occasional Visitor

Backup Azure Database for MySQL

 

--- backup single database:
mysqldump -Fc -v -h XXXXXXX.mysql.database.azure.com -u XXXXXXX -p -d databaseName1 > databaseName1_backup.sql

 

--- backup multiple database:

mysqldump -Fc -v -h XXXXXXX.mysql.database.azure.com -u XXXXXXX -p  --databases db1 db2 db3  > databases-backup.sql


--- backup all databases


mysqldump -Fc -v -h XXXXXXX.mysql.database.azure.com -u XXXXXXX -p --all-databases > all_databases_backup.sql


If you see issue "mysqldump: 1044 Access denied when using LOCK TABLES" Or
"Access denied for use '@'%' to database 'mysql' when using LOCK TABLES"

 

A quick workaround is to pass the –-single-transaction option to mysqldump:


mysqldump -Fc -v -h XXXXXXX.mysql.database.azure.com -u XXXXXXX -p --single-transaction --all-databases > all_databases_backup.sql

 

 

ref:

https://docs.microsoft.com/en-us/azure/mysql/

 

New Contributor

how can we restore it to our new paaS Database 

Microsoft

@Ops_Biren , thanks for your comment, restore from Azure Blog Storage should be similar

 

1- Navigate to your Azure Database for MySQL server on the portal and Run Azure Cloud Shell (Bash).  If you run this for the first time it will ask you to create a Storage container and and this will mount an Azure File in it.

2- Type df in the cloud shell and collect the Azure File path

3- Change directory to the cloud drive using the cd command
     in the example below I used cd /usr/bashar/clouddrive

4- Now that you are in that directory run mysql command,
example: mysql -h mydemoserver.mysql.database.azure.com -u myadmin@mydemoserver -p testdb < testdb_backup.sql

ref: https://docs.microsoft.com/en-us/azure/mysql/concepts-migrate-dump-restore#restore-your-mysql-databa...


New Contributor

Thank you for the useful article. It looks like this method leverages the cloud storage that is created when you run code from Azure Cloudshell. I'd like to run this remotely from something like Azure Automation on a regular schedule. Is there a way to use this same method without leveraging Azure Cloud Shell storage?

Occasional Visitor

@Bashar-MSFT Please have the image corrected and @hmikhan your comment updated.

 

For mysqldump, -d option is not used to specify database name. -d, --no-data No row information. This is used to take a dump of the database without any data.

 

-B is the option that should be used.

Microsoft

Hello @Bashar-MSFT ,

May I know what -Fc and -v are for?

Microsoft
@amritav Please use the command mysqldump --help to learn about all the options
 
 

 -F, --flush-logs Flush logs file in server before starting dump. Note that if you dump many databases at once (using the option --databases= or --all-databases), the logs will be flushed for each database dumped. The exception is when using --lock-all-tables or --master-data: in this case the logs will be flushed only once, corresponding to the moment all tables are locked. So if you want your dump and the log flush to happen at the same exact moment you should use --lock-all-tables or --master-data with --flush-logs.

 

-c, --complete-insert: Use complete insert statements.

-v, --verbose Print info about the various stages.

Microsoft

@dhruvraj Thanks sir, I fixed the screenshot. much appreciate your feedback

Microsoft

@Joel Hazelton  Sorry for the delayed response, please take a look at this blog post: 

https://techcommunity.microsoft.com/t5/azure-database-for-mysql/steps-to-automate-backups-of-your-az...