{"id":57057,"date":"2020-09-09T12:15:42","date_gmt":"2020-09-09T17:15:42","guid":{"rendered":"https:\/\/blog.cpanel.com\/?p=57057"},"modified":"2020-09-09T12:15:42","modified_gmt":"2020-09-09T17:15:42","slug":"how-to-back-up-and-restore-mysql-databases-in-cpanel","status":"publish","type":"post","link":"https:\/\/devel.www.cpanel.net\/blog\/tips-and-tricks\/how-to-back-up-and-restore-mysql-databases-in-cpanel\/","title":{"rendered":"How to Back Up and Restore MySQL\u00ae Databases in cPanel"},"content":{"rendered":"\n

Data that exist in one place barely exists at all. It\u2019s a hardware failure or mistyped command away from disappearing completely. That’s a scary thought, considering business’ most valuable assets include data. Imagine recreating everything in your database from scratch!<\/p>\n\n\n\n

Regular database backups are essential because that\u2019s where your most important data are stored, whether it\u2019s customer details, email addresses, product catalogs, content, or the hundreds of other types of information businesses need to function. MySQL\u00ae is by far the most widely used open-source database in the world, and that\u2019s why cPanel & WHM makes it so easy to back up and restore MySQL. <\/p>\n\n\n\n

In this article, we take a brief look at what a MySQL backup is and show you how to use cPanel\u2019s MySQL backup and restore tools to keep your data safe. <\/p>\n\n\n\n

What is MySQL?<\/strong><\/h2>\n\n\n\n

MySQL is an open-source relational database management system (RDBMS) used to store, organize, and retrieve information efficiently. cPanel & WHM uses MySQL, and so do many of the most popular content management systems and ecommerce applications, including WordPress\u00ae, Joomla, Drupal, and Magento\u00ae. <\/p>\n\n\n\n

MySQL stores data in tables, which are divided into columns of a predefined data type. Individual records make up the table\u2019s rows, and they have to conform to the types defined by the columns. For example, here is a section of the posts table from a new WordPress site\u2019s database. <\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

How do users get data into and out of MySQL? Unlike a file system, we can\u2019t just edit a file and hit save. We have to talk to the RDBMS in its own language, which is called SQL. To generate the table in the image, we sent the following SQL statement:<\/p>\n\n\n\n

SELECT ID,post_date,post_title,post_type,comment_count FROM wp_posts;<\/p>\n\n\n\n

As a cPanel user, you won\u2019t have to write SQL because cPanel takes care of that behind the scenes. However, it\u2019s useful to understand what it is because MySQL backups are just a list of SQL statements. <\/p>\n\n\n\n

When you run a backup, the software generates the statements needed to recreate the database and saves them to a file. This is often called \u201cexporting\u201d or \u201cdumping\u201d the database. When you restore, MySQL runs those statements to return the database to the state it was in when the backup was made. <\/p>\n\n\n\n

How to Back Up a MySQL Database in cPanel<\/strong><\/h2>\n\n\n\n

Our goal is to dump a database and download the resulting SQL file to our computer, where we can keep it or move it to a more secure location. It is possible to do this from the command line with the \u201cmysql\u201d client, but the cPanel MySQL backup and restore offers an easy-to-use interface.<\/p>\n\n\n\n

Either of these methods can be used to back up databases on your server. For this example we are going to use a WordPress installation and a WordPress Database.. A quick warning before we proceed: a WordPress site is composed of a database and<\/em> files and a complete WordPress backup must include both. <\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n