Migrate the mysql database to another hard drive
Archliun system mysql database
1. Partition and format the new hard disk
1) # fdisk / dev/sdb
2) # mkfs.ext4 / dev/sdb1
2. Stop the MYSQL service
Systemctl stop mysqld
3. Copy the database file
# cp-Rp data/ mnt/data/
4. Delete the original data file
# rm-rf / data
5. Prohibit booting self-starting MYSQL service
# systemctl disable mysqld
6. Mount the self-booting sdb1 partition to data
# vi / etc/fstab
/ dev/sdb1 / data ext4 rw,relatime,data=ordered 0 2
7. Copy the database file back to the original path
# cp-Rp / mnt/data/* / data/
8. Delete / mnt/data database directory
# rm-rf / mnt/data
9. Set / dara permissions
# chown-R mysql:mysql / data
10. Restore mysql service
# systemctl enable mysqld
# systemctl start mysqld