Home  >  Article  >  Database  >  How to modify the storage path of mysql configuration file data

How to modify the storage path of mysql configuration file data

coldplay.xixi
coldplay.xixiOriginal
2020-10-13 14:53:033868browse

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.

How to modify the storage path of mysql configuration file data

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn