Summary:

In a previous tutorial, we have seen how to save a MySQL Database with MySQLDump in Windows (WAMP). Today, we will see the quickest way to save a MySQL Database in Linux. For information databases. The backup also be done through a script that allows saving a database or set of databases.

But the script can be a little too complex for easy to use tool for backup, natively available in MySQL. So here, we are going to see how to save a MySQL database by using the Linux command line.

So we will use the command line for mysqldump. That can save a database to store it in a .sql file. That can be back later as well. In short, the SQL file will contain a set of commands. When it will be read by MySQL and will present the data to its original state (when it was backed up).

MySQLDump directly included in the installation of a MySQL Server. Suppose I want to save the database “bod007″ 🙂 in the file “bod007_nil84aug.sql”, I will use the following command:

mysqldump -u root -p --single-transaction --add-drop-database --databases bod007> bod007_nil84aug.sql

We, therefore, use the option “-databases” that add the “CREATE DATABASE” and “USE dbname”, allowing us to return the database more easily. We also used “-add-drop-databases” that adds “DROP DATABASE IF EXISTS” in the portion of the command “mysqldump”. This also allows easy relocation of a database by deleting the database restore to the server (if any) to be replaced by saved.

Finally, it specifies the name of the database to back up. Then redirects all to the file .sql wanted with the “>”, used to write the output of a command in a Linux file.

Popular Posts You May Read

Explore more hosting insights, tips and industry updates.

Modification of .NET Framework Virtual Directories in Plesk Control Panel

In order to provide running ASP.NET applications which use different NET framework versions within single…

How to Use Reboot and Shutdown Commands in Ubuntu Server

How to Use Reboot and Shutdown Commands in Ubuntu Server

Managing an Ubuntu server often requires restarting or shutting it down for maintenance, updates, or…

How to Create a Windows 8 VM quickly?

Use Convert-WindowsImage and create a Windows 8 VM quickly. Written in PowerShell, Convert-WindowsImage is a…