Home > Database > Mysql Tutorial > body text

How to modify the storage path of mysql configuration file data

coldplay.xixi
Release: 2020-10-13 14:53:03
Original
3783 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!