1. Be sure to close the Selinx before moving, this is very deceptive; (You must restart it after closing, this shutdown does not affect MySQL security) Vim/etc/selinux/config Open this file modification
selinux=enforcing-------To change this line to selinux=disabled, which is a security option that can't be used to access MySQL
selinuxtype=targeted-------This parameter must not be disabled, which causes the Linux system to fail to boot 2. mkdir DB----Create a data directory (you can create a logs folder under DB that is dedicated to a variety of MySQL logs) 3. Chown mysql.mysql db chown mysql.mysql db/mysql chown mysql.mysql db/mysql/* Change the permissions of the directory so that MySQL has permission to create files 3. /etc/init.d/mysql stop----Stop the MySQL service first or the move does not start normally after 3. MV/VAR/LIB/MYSQL/DB--Move the MySQL Data folder to the bottom of DB 4. VIM/ETC/MY.CNF Modify the configuration file inside the data directory and socket directory path and Binlog and Mysqld.log log path to the corresponding data directory 5. /etc/init.d/mysql inside of the data directory do not move, someone on the internet said need to change, the practice proved that no change, the judgment inside has been judged 6. /etc/init.d/mysql start database, no unexpected words will start normally
MySQL Data directory Mobile