MySQL database backup of several methods

Source: Internet
Author: User
Tags mysql client

MySQL has several ways to back up

Recently blogs have been trying to write some. But do not know what to write, feel that their recent knowledge has nothing to add, today I think of a blog can write. I have tried to back up MySQL from the data directory. But I've never been successful. A few days ago to help friends restore MySQL, and finally successfully restored the backup data directory successfully.

The MySQL database is the best database to use in a frequently used database, and the backup operation is no exception.

So let's share some of the ways MySQL databases are backed up today.

Way one: Use the command line.

The command line is faster. Just use the mysqldump command at the command line, which, by default, is in the bin folder of MySQL (if you need to add the Bin folder to path), then open the command line, switch to a drive letter, and enter "Mysqldump–u root–p Database name > backup file name. sql, click Enter, and after entering password, you can back up the corresponding database. Such backups are statements that do not have a built-in library. What you see:


Mode two: Using client software such as SQLyog

I think using the SQLyog software to back up the MySQL database. It's simpler than other backup methods, and it's easy to recover. A database backed up with such software is brought into the SQL statement of the built library. This makes it very easy to restore the database. Also practical navicat software to be used as MySQL Client,sqlyog is simpler than navicat. I am used to this software, but sometimes I need to open more than one form, I use Navicat software.

The SQLyog software interface can be seen in the following example:


Suppose you want to back up the database, right-click the pop-up menu on the database that needs to be backed up, select "Backup/Export" from the menu, and then select the word to back up in SQL file from the pop-up menu. What you see:


In the SQL dump form that pops up. You can back up the database by entering the name you want to back up. What you see:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbg9uz3l1ag9tzq==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">

Method Three: Back up the Data directory

The reason why I write this blog is to say the main way. Every time you need to install the operating system again, you need to back up all of the MySQL databases in the system. It is obviously very bad to assume that a backup of one is used in the way above.

This is what I did before, the reason is always unsuccessful when restoring. So I gave up. This way, from the Internet and books, the need for MySQL InnoDB engine.

This is the engine that is installed by default. Back up the time to back up the data folder under the MySQL folder, but later found that this method is not correct, you need to hide in the C-drive MySQL folder under the Data folder Backup, that is the real storage of MySQL data place.

The following is the MySQL installation folder, can see and do not have our database. For example, see the following:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbg9uz3l1ag9tzq==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">

Next, we're going to show the hidden files. And find, in the directory options, unhide the check box in front of the file. For example, see the following:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbg9uz3l1ag9tzq==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">

This allows you to see the hidden directory of all users in the user directory of the C drive. For example, see the following:

The data directory under the MySQL directory under its directory. will be able to see the files of our database today.

What you see:


Let's say we want a high-speed removal or backup of MySQL to be able to use this method to complete. If you want to, back up the corresponding folder for that database. Suppose you want to restore a database just by placing it in this hidden folder.

Don't forget it. When done, it is best to hide the original hidden files folder again, to avoid the future deletion of your system files.

Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

MySQL database backup of several methods

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.