The default installation path of yum in MySQL installation is /var/lib/mysql. In the project, you need to modify the MySQL data storage directory to the path of the mounted data disk.
df -h view disk space size
Migrate to the /home directory this time
1. Create the data directory in the home directory as the default path
mkdir -p /home/data
2. Turn off MySQL
systemctl stop mysqld.service
3. Migrate directory
cp -arp /var/lib/mysql /home/data/
The above cp -arp parameter is to keep the original file directory and file permissions directly copied to the target path.
4. Set directory permissions
chown -R mysql:mysql /home/data/mysql
The above cp -arp parameter is to keep the original file directory and file permissions directly copied to the target path.
5. Modify the configuration file
vim /etc/my.cnf
[mysqld]
character-set-server=utf8
[client]
default-character-set=utf8
6. SELINUX settings
vim /etc/selinux/config
Modify the parameters of SELINUX to disabled
7. Check whether the configuration takes effect