MySQL Data migration

Source: Internet
Author: User

The recently-online system has newly hung a disk, and the MySQL data directory under the system disk needs to be migrated to the data disk.

After some investigation, MySQL used the precompiled binary tar.gz package when it was installed. There are two DATADIR properties configured

/etc/init.d/mysqld and/ETC/MY.CNF

First step cleanup Bin-log

Speed up Replication

Mysql>purge master logs before ' Yyyy-mm-dd Hh-mm-ss '

Step two stop mysqld service

Service Mysqld Stop

The third step is to modify the configuration file

Total two places/etc/my.cnf/etc/init.d/mysqld

I'm here to modify data=/alidata/mysql/data for Datadir=/data/mysql

Fourth step, copy using the CP-RP command

cp-rp/alidata/mysql/data/*/data/mysql/

* Must be added, otherwise the previous data directory will be copied.

-R indicates that the copy subdirectory-P indicates a reserved property configuration (This is important, otherwise it will not start)

MySQL Data migration

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.