1. Prepare a new disk and format it with the same file system as the current root partition, create a directory and mount the disk ]#fdisk -l # View disk information ]#fdisk /dev/sdb # Partition ]# df -T # You can view the file system type of the root partition ]#mkfs.xfs /dev/sdb1 # Format the new disk partition ]#mkdir /data ]#mount /dev/sdb1 /data #Mount the disk or write to the /etc/fatab file, add a line: /dev/sdb1 /data xfs defaults 0 0 Automatically mount at boot]#df -h //Confirm the mount result 2. Stop the database service and modify the configuration file ]#systemctl stop mysqld ]#vim /etc/my.cnf datadir=/data/mysql socket=/data/mysql/mysql.sock log-error=/data/log/mysqld.log log_bin=/data/mysql/bin-log log-bin-index=/data/mysql/bin-log.index [client] socket=/data/mysql/mysql.sock #The mysql client sock reads /var/lib/mysql/mysql.sock by default, so you need to add the client sock configuration in the configuration file. ]#vim /data/mysql/bin-log.index Modify the binlog index file and re-specify the binlog storage path. 3. Create the corresponding directory and change the permissions. Migrate the database directory. ]#chown -R mysql:mysql /data ]#mkdir /data/log ]#mv /usr/lib/mysql /data/ 4. Start the service and view the change results. ]#systemctl start mysqld Enter the database mysql >show variables like 'datadir'; #You can see the storage location of the database and check whether the data is correct. mysql>show variables like '%sock%'; #Check the location of the sock file, or check whether the data in the corresponding directory /data/ is correct. The firewall is turned off and selinux is in Disabled state. Summarize The above is what I introduced to you on how to migrate the MySQL storage location to a new disk. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Detailed tutorial on running selenium+chromedriver on the server
>>: JavaScript canvas realizes dynamic point and line effect
Preface This article mainly shares with you the g...
Sometimes you need to create some test data, base...
Table of contents Review of Object.defineProperty...
<br />Simple example of adding and removing ...
Preface This article introduces the use of vue-ro...
Table of contents 1. BOM 2. Composition of BOM 2....
Public free STUN servers When the SIP terminal us...
This article shares the specific code for the WeC...
Table of contents 1. Download nodejs 2. Double-cl...
The Golden Rule No matter how many people are wor...
Table of contents 0. The kernel tree that comes w...
If there are files that are being used by a proce...
There was a shaking barrage on TikTok a while ago...
Load balancing is a commonly used device in serve...
Table of contents Demand background Thought Analy...