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