{"id":5435,"date":"2025-06-27T21:29:46","date_gmt":"2025-06-27T21:29:46","guid":{"rendered":"https:\/\/www.hostarmada.com\/blog\/?p=5435"},"modified":"2026-01-16T22:06:57","modified_gmt":"2026-01-16T22:06:57","slug":"mysql-backup","status":"publish","type":"post","link":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/","title":{"rendered":"How to Make a MySQL Database Backup (With Examples)"},"content":{"rendered":"\n<p>A MySQL backup is a copy of your database that allows you to restore data in case of deletion, corruption, or server failure. Command-line backups offer speed, precision, and flexibility, making them the preferred method for administrators and developers managing production databases. However, they must be executed correctly to ensure data consistency and avoid incomplete or unusable backups.<\/p>\n\n\n\n<p><span style=\"font-weight: 400\">That&#8217;s why learning how to create a <\/span>MySQL backup safely <span style=\"font-weight: 400\">is one of the most important lessons when you start managing your website&#8217;s inner workings. Most beginners don&#8217;t struggle with SQL syntax. The real risk lies in not backing up what they&#8217;ve already built.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">If you&#8217;re just starting to explore the backend of your website, mastering backups is even more critical than creating staging environments or spinning up new databases.<\/span> <span style=\"font-weight: 400\">Thus, we decided to write an in-depth guide specifically on creating and maintaining MySQL backups.<\/span><\/p>\n\n\n\n<p>I<span style=\"font-weight: 400\">n this tutorial, you\u2019ll learn how to back up entire databases, individual tables, and all databases on a server, along with best practices for verifying backups and storing them securely.<\/span> We&#8217;ll cover both one-time MySQL backups you run manually from the command line and scheduled or automated backups designed to run regularly without manual intervention.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-right counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #565656;color:#565656\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #565656;color:#565656\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#Importance_of_Regular_MySQL_Backups\" >Importance of Regular MySQL Backups<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#Using_mysqldump_for_CLI_MySQL_Backups\" >Using mysqldump for CLI MySQL Backups<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#Automating_MySQL_Backups_with_Scripts\" >Automating MySQL Backups with Scripts<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#GUI_and_cPanel_Backup_Options\" >GUI and cPanel Backup Options<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#Where_and_How_to_Store_Backups\" >Where and How to Store Backups<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#MySQL_Backups_are_Your_Safety_Net\" >MySQL Backups are Your Safety Net<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-importance-of-regular-mysql-backups\"><span class=\"ez-toc-section\" id=\"Importance_of_Regular_MySQL_Backups\"><\/span><span style=\"font-weight: 400\">Importance of Regular MySQL Backups<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><span style=\"font-weight: 400\">You don&#8217;t have to be a developer to accidentally delete your database. In our experience as hosting providers, we&#8217;ve witnessed all sorts of mishaps. Messing with the wrong plugin. Clicking on pop-ups that you don&#8217;t read because you&#8217;re in a hurry, or simply forgetting the name of the right database. We&#8217;ve seen it all.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Thankfully, we ensure all our users with managed hosting plans are regularly backed up so we can restore the database effortlessly and quickly.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Having a backup and a team of professionals to act lightning-fast certainly minimizes the damage. However, if you&#8217;re not using managed hosting or relying on less-than-trustworthy hosting providers, a deleted database can severely impact your business, especially if there&#8217;s no backup.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Backups act as your safety net. Whether you run a blog, a business website, or an eCommerce store, your database holds your site&#8217;s most valuable content. It&#8217;s where your website draws information about your users, orders, posts, forms, and everything related to your website. Without a recent copy, recovery becomes a guesswork process or an expensive endeavor, if it&#8217;s even possible.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">We&#8217;ve also seen cases where hosting servers fail, updates break compatibility, or someone accidentally drops a database table using phpMyAdmin. In one case, a beginner created a staging site without knowing it would overwrite their live content. Thankfully, we had a backup and restored their website in a matter of minutes, saving days of progress that otherwise would have been lost.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-regular-mysql-backups-make-sure-none-of-these-events-turn-into-disasters\"><span style=\"font-weight: 400\">Regular MySQL backups make sure none of these events turn into disasters.<\/span><\/h3>\n\n\n\n<p><span style=\"font-weight: 400\">And &#8220;regular&#8221; doesn&#8217;t mean once a month. For active sites, a daily backup is often the minimum. For high-traffic stores or dynamic platforms, multiple daily backups are ideal.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">MySQL backups are essential when undergoing major WordPress or plugin upgrades, plugin installations, or even if you want to <\/span><a href=\"https:\/\/www.hostarmada.com\/blog\/install-wordpress-on-localhost\/\"><span style=\"font-weight: 400\">downgrade WordPress<\/span><\/a><span style=\"font-weight: 400\"> if a plugin or a theme is acting weird on the new version.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Now, you might feel scared to even try touching MySQL. However, that&#8217;s not a solution. If you want to, you can always try playing around with the security of your own server. All you need to know is <\/span><a href=\"https:\/\/www.hostarmada.com\/blog\/install-wordpress-on-localhost\/\"><span style=\"font-weight: 400\">how to install WordPress on localhost<\/span><\/a><span style=\"font-weight: 400\">, and you can experiment safely there.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">So, now that we know why, let&#8217;s move on to the how.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-using-mysqldump-for-cli-mysql-backups\"><span class=\"ez-toc-section\" id=\"Using_mysqldump_for_CLI_MySQL_Backups\"><\/span><span style=\"font-weight: 400\">Using mysqldump for CLI MySQL Backups<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><span style=\"font-weight: 400\">While HostArmada offers its users the opportunity to <\/span><a href=\"https:\/\/hostarmada.com\/tutorials\/getting-started\/cpanel\/how-to-manage-your-mysql-databases-in-cpanel\/\"><span style=\"font-weight: 400\">manage MySQL database in cPanel<\/span><\/a><span style=\"font-weight: 400\">, it&#8217;s wise to learn how to do that through the command line. It&#8217;s the most effective way to backup your MySQL with full control over what you export. It&#8217;s perfect for manual backups or advanced automation down the road.<\/span> <span style=\"font-weight: 400\">All you need to learn is one easy command: mysqldump<\/span>.<\/p>\n\n\n\n<p><strong>Note: <\/strong>Creating MySQL backups requires sufficient database privileges (such as SELECT, LOCK TABLES, or administrative access) as well as shell access to the server where MySQL is running.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-what-is-mysqldump\"><span style=\"font-weight: 400\">What Is mysqldump?<\/span><\/h3>\n\n\n\n<p><span style=\"font-weight: 400\">Mysqldump is a utility that creates a .sql file containing the structure and data of your database. This file can later be used to restore your site or migrate to a new server.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Think of it as creating a full snapshot of your database: tables, records, relationships, and all.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-mysqldump-in-action\"><span style=\"font-weight: 400\">mysqldump in Action<\/span><\/h3>\n\n\n\n<p><span style=\"font-weight: 400\">Here&#8217;s basically what you need to enter<\/span><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>mysqldump -u root -p my_website_db > my_website_backup.sql<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">mysqldump <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9FF\">u <\/span><span style=\"color: #81A1C1\">root<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9FF\">p my_website_db <\/span><span style=\"color: #81A1C1\">&gt;<\/span><span style=\"color: #D8DEE9FF\"> my_website_backup.sql<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><span style=\"font-weight: 400\">This command tells MySQL to:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span style=\"font-weight: 400\">Use the root user<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Prompt for your password (-p)<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Dump everything from my_website_db<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Save it into a file called my_website_backup.sql in your current directory<\/span><\/li>\n<\/ul>\n\n\n\n<p><span style=\"font-weight: 400\">In our experience, it&#8217;s best if you double-check that you&#8217;re in a folder with write access before running the command. Also, ensure there are no typos in the database name.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">If you&#8217;ve forgotten your database name, just use the <\/span><a href=\"https:\/\/www.hostarmada.com\/blog\/show-databases-guide\/\"><span style=\"font-weight: 400\">show databases<\/span><\/a><span style=\"font-weight: 400\"> command in your MySQL shell.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-backing-up-multiple-databases\"><span style=\"font-weight: 400\">Backing Up Multiple Databases<\/span><\/h3>\n\n\n\n<p><span style=\"font-weight: 400\">To back up more than one database at a time:<\/span><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>mysqldump -u root -p --databases db1 db2 db3 > multi_backup.sql<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">mysqldump <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9FF\">u <\/span><span style=\"color: #81A1C1\">root<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9FF\">p <\/span><span style=\"color: #616E88\">--databases db1 db2 db3 &gt; multi_backup.sql<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><span style=\"font-weight: 400\">Need to back up everything? Use the &#8211;all-databases flag:<\/span><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>mysqldump -u root -p --all-databases > full_backup.sql<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">mysqldump <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9FF\">u <\/span><span style=\"color: #81A1C1\">root<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9FF\">p <\/span><span style=\"color: #616E88\">--all-databases &gt; full_backup.sql<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><span style=\"font-weight: 400\">Avoiding Beginner Mistakes<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Don&#8217;t assume backups work just because the file exists. After creating a .sql backup, open it in a code editor or test it in a <\/span><a href=\"https:\/\/www.hostarmada.com\/blog\/what-is-website-staging-and-should-you-use-it-for-your-wordpress-website\/\"><span style=\"font-weight: 400\">staging environment<\/span><\/a><span style=\"font-weight: 400\">. This ensures you didn&#8217;t accidentally back up an empty or incorrect database.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-automating-mysql-backups-with-scripts\"><span class=\"ez-toc-section\" id=\"Automating_MySQL_Backups_with_Scripts\"><\/span><span style=\"font-weight: 400\">Automating MySQL Backups with Scripts<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><span style=\"font-weight: 400\">Doing manual backups every time you update your site quickly becomes tedious and, honestly, a productivity killer. At first, it might feel satisfying to type in the command and generate your .sql file. But repeat that five or more times a day, and it becomes a chore you&#8217;re likely to skip when it matters most.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">While knowing <\/span><a href=\"https:\/\/www.hostarmada.com\/blog\/how-to-create-database-in-mysql-command-line\/\"><span style=\"font-weight: 400\">how to create database in mysql command line<\/span><\/a><span style=\"font-weight: 400\"> is an important foundational skill, it&#8217;s not something you need to do every day. Backing up your database, on the other hand, is a task you may need to perform multiple times per day, especially if you&#8217;re actively developing, managing transactions, or deploying frequent updates.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">That\u2019s where automation steps in. With just a few lines of code, you can schedule your backups to run silently in the background, saving time, eliminating human error, and giving you peace of mind.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Here&#8217;s what you need to do:<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-sample-backup-script-linux\"><span style=\"font-weight: 400\">Sample Backup Script (Linux)<\/span><\/h3>\n\n\n\n<p><span style=\"font-weight: 400\">Here\u2019s a basic shell script to back up a single MySQL database:<\/span><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>#!\/bin\/bash\n\n# Set credentials and file name\nUSER=\"root\"\nPASSWORD=\"your_password\"\nDATABASE=\"my_website_db\"\nOUTPUT=\"\/backups\/db_backup_$(date +%F_%H-%M).sql\"\n\n# Create the backup\nmysqldump -u $USER -p$PASSWORD $DATABASE > $OUTPUT<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #616E88\">#!\/bin\/bash<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Set credentials and file name<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">USER<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">root<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">PASSWORD<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">your_password<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">DATABASE<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">my_website_db<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">OUTPUT<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">\/backups\/db_backup_<\/span><span style=\"color: #ECEFF4\">$(<\/span><span style=\"color: #88C0D0\">date<\/span><span style=\"color: #A3BE8C\"> +%F_%H-%M<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #A3BE8C\">.sql<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #616E88\"># Create the backup<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">mysqldump<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-u<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">$USER<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-p<\/span><span style=\"color: #D8DEE9\">$PASSWORD<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">$DATABASE<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">&gt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">$OUTPUT<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><span style=\"font-weight: 400\">Save it as mysql_backup.sh, and make it executable:<\/span><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>chmod +x mysql_backup.sh<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #88C0D0\">chmod<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">+x<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">mysql_backup.sh<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><span style=\"font-weight: 400\">Schedule it with cron:<\/span><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>crontab -e<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #88C0D0\">crontab<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-e<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><span style=\"font-weight: 400\">Add this to run daily at 2:00 AM:<\/span><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>0 2 * * * \/path\/to\/mysql_backup.sh<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #88C0D0\">0<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">2<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">*<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">*<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">*<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">\/path\/to\/mysql_backup.sh<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><span style=\"font-weight: 400\">This generates timestamped backups like db_backup_2025-06-26_02-00.sql, making it easy to organize or rollback.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-sample-backup-script-windows\"><span style=\"font-weight: 400\">Sample Backup Script (Windows)<\/span><\/h3>\n\n\n\n<p><span style=\"font-weight: 400\">For Windows, you can use a simple .bat file:<\/span><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>mysqldump -u root -pYourPassword my_website_db > C:db_backupsbackup.sql<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #88C0D0\">mysqldump<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-u<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">root<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-pYourPassword<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">my_website_db<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">&gt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">C:db_backupsbackup.sql<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><span style=\"font-weight: 400\">Then automate it:<\/span><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><span style=\"font-weight: 400\">Open Task Scheduler<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Create a new basic task<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Set your schedule<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Point to the .bat file<\/span><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-automating-multiple-backups\"><span style=\"font-weight: 400\">Automating multiple backups<\/span><\/h3>\n\n\n\n<p><span style=\"font-weight: 400\">Need to back up several databases? Use a loop in your script:<\/span><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>DATABASES=\"db1 db2 db3\"\n\nfor DB in $DATABASES\ndo\n  mysqldump -u $USER -p$PASSWORD $DB > \/backups\/${DB}_$(date +%F).sql\ndone\n<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9\">DATABASES<\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">db1 db2 db3<\/span><span style=\"color: #ECEFF4\">&quot;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">for<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">DB<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">in<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">$DATABASES<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">do<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">  <\/span><span style=\"color: #88C0D0\">mysqldump<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-u<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">$USER<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">-p<\/span><span style=\"color: #D8DEE9\">$PASSWORD<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">$DB<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">&gt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #A3BE8C\">\/backups\/<\/span><span style=\"color: #81A1C1\">${<\/span><span style=\"color: #D8DEE9\">DB<\/span><span style=\"color: #81A1C1\">}<\/span><span style=\"color: #A3BE8C\">_<\/span><span style=\"color: #ECEFF4\">$(<\/span><span style=\"color: #88C0D0\">date<\/span><span style=\"color: #A3BE8C\"> +%F<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #A3BE8C\">.sql<\/span><\/span>\n<span class=\"line\"><span style=\"color: #81A1C1\">done<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p><span style=\"font-weight: 400\">Each backup is saved as a separate, date-labeled file.<\/span><\/p>\n\n\n\n<p>Remember:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span style=\"font-weight: 400\">Store backups outside your main hosting folder when possible<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Use restricted permissions to secure backup directories<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Test your script after editing. Don\u2019t assume it\u2019s working silently<\/span><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-gui-and-cpanel-backup-options\"><span class=\"ez-toc-section\" id=\"GUI_and_cPanel_Backup_Options\"><\/span><span style=\"font-weight: 400\">GUI and cPanel Backup Options<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><span style=\"font-weight: 400\">Not everyone wants to mess with command-line tools, and that\u2019s perfectly fine. If you&#8217;re more comfortable with a visual interface, cPanel and graphical tools like MySQL Workbench offer a simpler way to create backups. Coding is hard, and that&#8217;s why most good hosting providers give you access to cPanel.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Typically, the pathway is easy:<\/span><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><b>Log into your cPanel account<\/b><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Scroll to the <\/span><b>&#8220;Files&#8221;<\/b><span style=\"font-weight: 400\"> section and click <\/span><b>\u201cBackup\u201d<\/b><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Under <\/span><b>&#8220;Download a MySQL Database Backup,&#8221;<\/b><span style=\"font-weight: 400\"> select your database name<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Click to download the .sql.gz file \u2014 that\u2019s your backup!<\/span><\/li>\n<\/ol>\n\n\n\n<p><span style=\"font-weight: 400\">You can\u2019t preview what\u2019s inside a .gz file unless you extract it. Always double-check the file size and date before considering the backup valid.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">There might be some divisions depending on your hosting provider. If you&#8217;re a HostArmada user with managed hosting plan, you don&#8217;t need to worry about backups. Still, if you want to know where the magic happens, our <\/span><a href=\"https:\/\/hostarmada.com\/tutorials\/getting-started\/whm\/how-to-use-the-backup-configuration-feature-in-whm\/\"><span style=\"font-weight: 400\">How to Use the Backup Configuration Feature in WHM<\/span><\/a><span style=\"font-weight: 400\"> guide will lead you through the process.\u00a0\u00a0<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-mysql-workbench-gui\"><span style=\"font-weight: 400\">MySQL Workbench (GUI)<\/span><\/h3>\n\n\n\n<p><span style=\"font-weight: 400\">MySQL Workbench is another great option if you&#8217;re managing your site from a local computer. It&#8217;s a free graphical interface for interacting with MySQL databases.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">To back up using Workbench:<\/span><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><span style=\"font-weight: 400\">Open MySQL Workbench and connect to your database<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Go to <\/span><b>server&gt; Data Export<\/b><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Choose your database and export options<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400\">Click <\/span><b>Start Export<\/b><\/li>\n<\/ol>\n\n\n\n<p><span style=\"font-weight: 400\">This tool is especially handy for remote database management or when you don\u2019t want to log into hosting panels regularly.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">If you\u2019re doing multiple backups per day or running production sites, CLI + automation will still be your best long-term strategy. But GUI options are a great entry point and excellent for low-risk tasks or manual snapshots before updates.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-where-and-how-to-store-backups\"><span class=\"ez-toc-section\" id=\"Where_and_How_to_Store_Backups\"><\/span><span style=\"font-weight: 400\">Where and How to Store Backups<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><span style=\"font-weight: 400\">Considering how important the backup is, it&#8217;s only logical you&#8217;d want to keep it somewhere safe. While your server is definitely among the most secure places you can choose, if it&#8217;s the same server where the original database is, that&#8217;s not ideal. If the server gets corrupted, crashes, or entirely burns out, your MySQL backup will be just as gone as the original database.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">So, here&#8217;s what to do<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-use-off-site-or-cloud-storage\"><span style=\"font-weight: 400\">Use Off-Site or Cloud Storage<\/span><\/h3>\n\n\n\n<p><span style=\"font-weight: 400\">This is the bare minimum. Your MySQL backup should be on a separate server or in the cloud, away from your live website. You can keep it in Google Drive, Dropbox, or a remote FTP Server. In our experience, the first two are ideal for beginners, as they are familiar and easy to access. However, they are not the most secure environments.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">The FTP Server is much better secured, but it&#8217;s also more expensive. Having a dedicated storage server doesn&#8217;t come cheap.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Finally, you can choose Amazon S3 or BackBlazeB2, which are ideal for long-term storage with built-in redundancy.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-keep-a-local-copy\"><span style=\"font-weight: 400\">Keep a Local Copy<\/span><\/h3>\n\n\n\n<p><span style=\"font-weight: 400\">Saving backups to your personal computer is convenient, but it shouldn\u2019t be your only strategy. Hard drives fail, laptops get stolen, and files can be overwritten. Still, having a local copy is smart, especially for quick testing or rollback during development.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-structure-and-label-backups-clearly\"><span style=\"font-weight: 400\">Structure and Label Backups Clearly<\/span><\/h3>\n\n\n\n<p><span style=\"font-weight: 400\">You need to know which backup is which. If you want to revert to a previous version of your website, one that&#8217;s not yet corrupted, yet you have maximum information, it&#8217;s not enough to roll back to the last MySQL backup. The breach may have occurred several days ago, so you need to know precisely when each backup was taken. The easiest way to do that is to timestamp your MySQL backups in the filename, as well as the backed-up environment. For example, &#8220;production_website_database-06-26.sql&#8221;<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">This makes it easier to find the right version quickly, especially during high-stress moments like a restore or migration.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-encrypt-and-protect-your-backup-files\"><span style=\"font-weight: 400\">Encrypt and Protect Your Backup Files<\/span><\/h3>\n\n\n\n<p><span style=\"font-weight: 400\">Corrupt backup files are not as rare as one may think. That&#8217;s less than ideal, as MySQL backups usually contain sensitive user data like emails, passwords, personal info, and other information. If they fall into the wrong hands, your site could face legal and security risks.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Use tools like gpg or ZIP encryption to secure your backup files. Always apply proper file permissions (e.g., chmod 600) when storing backups on a server.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">In our experience, while regular backups are essential, what makes a recovery plan reliable is how smart and secure you will store your MySQL backup.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-mysql-backups-are-your-safety-net\"><span class=\"ez-toc-section\" id=\"MySQL_Backups_are_Your_Safety_Net\"><\/span><span style=\"font-weight: 400\">MySQL Backups are Your Safety Net<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><span style=\"font-weight: 400\">Learning how to create and store a MySQL backup isn\u2019t just a technical skill. It\u2019s your website\u2019s safety net. It doesn&#8217;t take a malicious act to lose your database. All it takes is a moment of absentmindedness to see years&#8217; worth of work gone forever. That\u2019s why understanding backups is more important than knowing how to stage, migrate, or even create a new database.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">But here&#8217;s the good news. You don\u2019t have to handle it all on your own.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">At <\/span><a href=\"https:\/\/hostarmada.com\/\"><b>HostArmada<\/b><\/a><span style=\"font-weight: 400\">, we completely eliminate the stress of backups. Every hosting plan includes automated daily backups, with the number of backups scaling up depending on the plan you choose. Whether you\u2019re launching a personal blog or managing an e-commerce store, we\u2019ve got your data protected.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">And if something ever does go wrong, our 24\/7\/365 support team is just one chat, call, email, or ticket away. It&#8217;s up to you how you want to communicate with them.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">e can restore your site from a recent backup in less than an hour \u2014 so you can stay focused on growing your business, not fixing tech disasters.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400\">Plus, all HostArmada plans come with<\/span> <span style=\"font-weight: 400\">lightning-fast speeds, top-of-the-line security, and a 99.9% uptime guarantee,<\/span> <span style=\"font-weight: 400\">giving you peace of mind from day one.<\/span><\/p>\n\n\n\n<p><a href=\"https:\/\/www.hostarmada.com\/pricing\/\"><span style=\"font-weight: 400\">Check out our hosting plans<\/span><\/a> <span style=\"font-weight: 400\">and choose the one that fits your needs best. Your data deserves it.<\/span><\/p>\n\n\n\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A MySQL backup is a copy of your database that allows you to restore data in case of deletion, corruption, or server failure. Command-line backups offer speed, precision, and flexibility, making them the preferred method for administrators and developers managing production databases. However, they must be executed correctly to ensure data consistency and avoid incomplete [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":5467,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[102,103,30],"tags":[228,226,227,158,225],"class_list":["post-5435","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-databases","category-mysql","category-technical-tips","tag-database-backups","tag-database-security","tag-mysql-administration","tag-server-management","tag-sql-tutorials"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.5 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Make a MySQL Database Backup (With Examples)<\/title>\n<meta name=\"description\" content=\"Learn how to create secure MySQL database backups using command-line tools, with practical examples and best practices.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Make a MySQL Database Backup (With Examples)\" \/>\n<meta property=\"og:description\" content=\"Learn how to create secure MySQL database backups using command-line tools, with practical examples and best practices.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/\" \/>\n<meta property=\"og:site_name\" content=\"HostArmada Blog\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-27T21:29:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-16T22:06:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.hostarmada.com\/blog\/wp-content\/uploads\/2025\/06\/how-to-make-a-mysql-database-backup-with-examples-scaled.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1280\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Martin Atanasov\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Martin Atanasov\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/mysql-backup\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/mysql-backup\\\/\"},\"author\":{\"name\":\"Martin Atanasov\",\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/#\\\/schema\\\/person\\\/bbee34d0c0ea3ce71be141120a57ce77\"},\"headline\":\"How to Make a MySQL Database Backup (With Examples)\",\"datePublished\":\"2025-06-27T21:29:46+00:00\",\"dateModified\":\"2026-01-16T22:06:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/mysql-backup\\\/\"},\"wordCount\":2153,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/mysql-backup\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/how-to-make-a-mysql-database-backup-with-examples-scaled.png\",\"keywords\":[\"database backups\",\"database security\",\"MySQL administration\",\"server management\",\"SQL tutorials\"],\"articleSection\":[\"Databases\",\"MySQL\",\"Technical Tips\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/mysql-backup\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/mysql-backup\\\/\",\"url\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/mysql-backup\\\/\",\"name\":\"How to Make a MySQL Database Backup (With Examples)\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/mysql-backup\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/mysql-backup\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/how-to-make-a-mysql-database-backup-with-examples-scaled.png\",\"datePublished\":\"2025-06-27T21:29:46+00:00\",\"dateModified\":\"2026-01-16T22:06:57+00:00\",\"description\":\"Learn how to create secure MySQL database backups using command-line tools, with practical examples and best practices.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/mysql-backup\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/mysql-backup\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/mysql-backup\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/how-to-make-a-mysql-database-backup-with-examples-scaled.png\",\"contentUrl\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/how-to-make-a-mysql-database-backup-with-examples-scaled.png\",\"width\":2560,\"height\":1280,\"caption\":\"How to Make a MySQL Database Backup (With Examples)\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/mysql-backup\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"HostArmada Blog\",\"item\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Make a MySQL Database Backup (With Examples)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/\",\"name\":\"HostArmada Blog\",\"description\":\"HostArmada official blog. Useful web hosting related articles.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/#organization\",\"name\":\"HostArmada Blog\",\"url\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/logo-png-300x43-1.png\",\"contentUrl\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/logo-png-300x43-1.png\",\"width\":300,\"height\":44,\"caption\":\"HostArmada Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/#\\\/schema\\\/person\\\/bbee34d0c0ea3ce71be141120a57ce77\",\"name\":\"Martin Atanasov\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f05b145ab7d0cedd034f0325cb9f16f3bb0f1da31e03e0f042f5e79a1cb0496b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f05b145ab7d0cedd034f0325cb9f16f3bb0f1da31e03e0f042f5e79a1cb0496b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f05b145ab7d0cedd034f0325cb9f16f3bb0f1da31e03e0f042f5e79a1cb0496b?s=96&d=mm&r=g\",\"caption\":\"Martin Atanasov\"},\"description\":\"Martin is a content writer, copywriter, and blogger with vast experience in journalism and digital marketing. He has hundreds of articles on topics ranging from SEO, digital marketing, web content, and brand marketing. With his unique ability to convey complex issues and technical topics in a relatable and understandable language, Martin is determined to give our readers an inside look, professional tips, and useful advice on all aspects of the Web Hosting Service.\",\"sameAs\":[\"https:\\\/\\\/hostarmada.com\"],\"url\":\"https:\\\/\\\/www.hostarmada.com\\\/blog\\\/author\\\/martinatanasov737\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Make a MySQL Database Backup (With Examples)","description":"Learn how to create secure MySQL database backups using command-line tools, with practical examples and best practices.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/","og_locale":"en_US","og_type":"article","og_title":"How to Make a MySQL Database Backup (With Examples)","og_description":"Learn how to create secure MySQL database backups using command-line tools, with practical examples and best practices.","og_url":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/","og_site_name":"HostArmada Blog","article_published_time":"2025-06-27T21:29:46+00:00","article_modified_time":"2026-01-16T22:06:57+00:00","og_image":[{"width":2560,"height":1280,"url":"https:\/\/www.hostarmada.com\/blog\/wp-content\/uploads\/2025\/06\/how-to-make-a-mysql-database-backup-with-examples-scaled.png","type":"image\/png"}],"author":"Martin Atanasov","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Martin Atanasov","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#article","isPartOf":{"@id":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/"},"author":{"name":"Martin Atanasov","@id":"https:\/\/www.hostarmada.com\/blog\/#\/schema\/person\/bbee34d0c0ea3ce71be141120a57ce77"},"headline":"How to Make a MySQL Database Backup (With Examples)","datePublished":"2025-06-27T21:29:46+00:00","dateModified":"2026-01-16T22:06:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/"},"wordCount":2153,"commentCount":0,"publisher":{"@id":"https:\/\/www.hostarmada.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#primaryimage"},"thumbnailUrl":"https:\/\/www.hostarmada.com\/blog\/wp-content\/uploads\/2025\/06\/how-to-make-a-mysql-database-backup-with-examples-scaled.png","keywords":["database backups","database security","MySQL administration","server management","SQL tutorials"],"articleSection":["Databases","MySQL","Technical Tips"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/","url":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/","name":"How to Make a MySQL Database Backup (With Examples)","isPartOf":{"@id":"https:\/\/www.hostarmada.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#primaryimage"},"image":{"@id":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#primaryimage"},"thumbnailUrl":"https:\/\/www.hostarmada.com\/blog\/wp-content\/uploads\/2025\/06\/how-to-make-a-mysql-database-backup-with-examples-scaled.png","datePublished":"2025-06-27T21:29:46+00:00","dateModified":"2026-01-16T22:06:57+00:00","description":"Learn how to create secure MySQL database backups using command-line tools, with practical examples and best practices.","breadcrumb":{"@id":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hostarmada.com\/blog\/mysql-backup\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#primaryimage","url":"https:\/\/www.hostarmada.com\/blog\/wp-content\/uploads\/2025\/06\/how-to-make-a-mysql-database-backup-with-examples-scaled.png","contentUrl":"https:\/\/www.hostarmada.com\/blog\/wp-content\/uploads\/2025\/06\/how-to-make-a-mysql-database-backup-with-examples-scaled.png","width":2560,"height":1280,"caption":"How to Make a MySQL Database Backup (With Examples)"},{"@type":"BreadcrumbList","@id":"https:\/\/www.hostarmada.com\/blog\/mysql-backup\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"HostArmada Blog","item":"https:\/\/www.hostarmada.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Make a MySQL Database Backup (With Examples)"}]},{"@type":"WebSite","@id":"https:\/\/www.hostarmada.com\/blog\/#website","url":"https:\/\/www.hostarmada.com\/blog\/","name":"HostArmada Blog","description":"HostArmada official blog. Useful web hosting related articles.","publisher":{"@id":"https:\/\/www.hostarmada.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hostarmada.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.hostarmada.com\/blog\/#organization","name":"HostArmada Blog","url":"https:\/\/www.hostarmada.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.hostarmada.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.hostarmada.com\/blog\/wp-content\/uploads\/2022\/06\/logo-png-300x43-1.png","contentUrl":"https:\/\/www.hostarmada.com\/blog\/wp-content\/uploads\/2022\/06\/logo-png-300x43-1.png","width":300,"height":44,"caption":"HostArmada Blog"},"image":{"@id":"https:\/\/www.hostarmada.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.hostarmada.com\/blog\/#\/schema\/person\/bbee34d0c0ea3ce71be141120a57ce77","name":"Martin Atanasov","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f05b145ab7d0cedd034f0325cb9f16f3bb0f1da31e03e0f042f5e79a1cb0496b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f05b145ab7d0cedd034f0325cb9f16f3bb0f1da31e03e0f042f5e79a1cb0496b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f05b145ab7d0cedd034f0325cb9f16f3bb0f1da31e03e0f042f5e79a1cb0496b?s=96&d=mm&r=g","caption":"Martin Atanasov"},"description":"Martin is a content writer, copywriter, and blogger with vast experience in journalism and digital marketing. He has hundreds of articles on topics ranging from SEO, digital marketing, web content, and brand marketing. With his unique ability to convey complex issues and technical topics in a relatable and understandable language, Martin is determined to give our readers an inside look, professional tips, and useful advice on all aspects of the Web Hosting Service.","sameAs":["https:\/\/hostarmada.com"],"url":"https:\/\/www.hostarmada.com\/blog\/author\/martinatanasov737\/"}]}},"_links":{"self":[{"href":"https:\/\/www.hostarmada.com\/blog\/wp-json\/wp\/v2\/posts\/5435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostarmada.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostarmada.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostarmada.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostarmada.com\/blog\/wp-json\/wp\/v2\/comments?post=5435"}],"version-history":[{"count":10,"href":"https:\/\/www.hostarmada.com\/blog\/wp-json\/wp\/v2\/posts\/5435\/revisions"}],"predecessor-version":[{"id":6086,"href":"https:\/\/www.hostarmada.com\/blog\/wp-json\/wp\/v2\/posts\/5435\/revisions\/6086"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostarmada.com\/blog\/wp-json\/wp\/v2\/media\/5467"}],"wp:attachment":[{"href":"https:\/\/www.hostarmada.com\/blog\/wp-json\/wp\/v2\/media?parent=5435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostarmada.com\/blog\/wp-json\/wp\/v2\/categories?post=5435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostarmada.com\/blog\/wp-json\/wp\/v2\/tags?post=5435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}