In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
After installing the MySQL database using the rpm installation, the default path for the data file is / var/lib/mysql, but the root directory is not suitable for storing the data file, so we need to change the default path for the database file.
The change method is as follows:
Environment introduction:
Original path: / var/lib/mysql
Destination path: / home/mysql_data/mysql
Linux system version: centos7.6
MySQL database version: 5.7.25
Free study video tutorial: mysql video tutorial
Specific steps:
1. Create the target path
Mkdir-p / home/mysql_data
2. Close MySQL
Systemctl stop mysqld
3. Copy data files
Cp-arp / var/lib/mysql / home/mysql_data
4. Modify the configuration file / etc/my.cnf
Modify the original path in datadir and socket to the target path
Datadir=/home/mysql_data/mysqlsocket=/home/mysql_data/mysql/mysql.sock
5. Start the MySQL service
Systemctl start mysqld
NOTE:
1. The error is as follows:
Resolve:
Execute the command:
Setenforce 1
And then reboot.
2. The error report is as follows:
Can't connect to local MySQL server through socket'/ var/lib/mysql/mysql.sock'
Resolve:
Modify the configuration file my.cnf to add or modify the following configuration:
[client] socket = / home/mysql_data/mysql/mysql.sock
These are the details of changing the default path of mysql data files under linux. Please pay more attention to other related articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.