Method to modify the storage path of mysql configuration file data: first create the target path and close MySQL; then copy the data file; finally modify the configuration file [/etc/my.cnf] and start the MySQL service.
Method to modify the storage path of mysql configuration file data:
Steps:
1 , Create the target path
mkdir -p /home/mysql_data
2. Close MySQL
systemctl stop mysqld
3. Copy the data file
cp -arp /var/lib/mysql /home/mysql_data
4. Modify the configuration file /etc/my.cnf
Modify the original paths in datadir and socket to the target Path
datadir=/home/mysql_data/mysql
socket=/home/mysql_data/mysql/mysql.sock
5. Start the MySQL service
systemctl start mysqld
More related free learning recommendations:mysql tutorial(Video)
The above is the detailed content of How to modify the storage path of mysql configuration file data. For more information, please follow other related articles on the PHP Chinese website!