Linux system backup MySQL database method (MyISAM and InnoDB)

Source: Internet
Author: User
Tags types of tables vps windows vps

Today new on a Linode VPS, choose Japan's Data Center! The speed is quite fast, the ping value is very low.


The direct clicks, registers the input da932e6d6e613d7e0ae2cd3bc1302581a927fb04, after using 3 months, Linode will return to me the $. Hey!

By the way, Linode has no windows VPS.

Today this article is mainly to record a little about the MySQL data file import, export issues. This involves two types of data in MyISAM and InnoDB.

MyISAM data type is not said, direct export, import can be used!

Cause: I have a wordpress station. There are InnoDB and MyISAM in the data type, and the InnoDB cannot be displayed in the imported data file. To this end, but also to replace the lnmp1.1 1.0, and finally found that as long as the INNODB data in the imported database can not be displayed, only know that it may be related to MySQL data types.

Online check, "InnoDB" type, this type of a table on the disk only corresponds to a "*.frm" file, unlike MyISAM as "*. myd,*. Myi "file.

MyISAM types of tables are directly copied to another database and can be used directly, but INNODB types of tables are not. The solution is:

Simultaneously copies the InnoDB database table "*.frm" file and the InnoDB data "ibdata1" file to the appropriate location.

That is, when the database engine type is InnoDB, copying the data file also requires copying the ibdata1.

Finally stop the MySQL service, the directory under the ib_logfile* files are all deleted, restart the MySQL service, completed.

It's just a manual backup, and if we want to be more advanced it needs to be backed up automatically.

Edit an SH file first:

The code is as follows Copy Code
CODE
vi/var/local/bin/crontab/backup_db.sh
Content is:
CODE
cd/var/backup/db
Rm-f Database.sql
Mysqldump–opt-uroot Database>database.sql
Rm-f database. ' Date-d today +\%w '. tar.gz
TAR-ZVCF database. ' Date-d today +\%w '. tar.gz database.sql
SCP database. ' Date-d today +\%w '. tar.gz backup.verycd.com:/var/backup/db/
Then edit crontab:
CODE
Crontab-e
Increase:
CODE
0 3 * * * SH backup_db.sh

This log is about to complete, I do not know is Firefox bugs or forum JS Bug, the content of all of a sudden all gone, and no "backup", tearful rewrite ... Remember to open Notepad first.

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.