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
Here are some problems encountered in the use of ...
Solution-1: Download the msvcr100.dll file (find ...
In the past few years, DIV+CSS was very popular in...
Table of contents 1. What is Proxy? 2. How to use...
Preface The previous article introduced the insta...
This article shares with you how to use Navicat t...
Preface Any application that can be written in Ja...
How to define and use: Use the slot tag definitio...
In the process of learning CSS3, I found that man...
I have never been able to figure out whether the ...
1. OpenSSL official website Official download add...
1. According to the online tutorial, the installa...
1. Create a docker network card [root@i ~]# brctl...
1. Find the corresponding nodejs package, refer t...
Table of contents Zabbix monitors Nginx Zabbix mo...