How to implement Mysql switching data storage directory

How to implement Mysql switching data storage directory

How to implement Mysql switching data storage directory

Today, I encountered at work that the partition space where mysql is stored has been used up, resulting in mysql being unable to start normally. For this reason, I had to migrate the data storage directory.

1. Transfer the existing data storage directory to another storage space. Today, it took more than 30 minutes to copy a 50G data file, which was a bit slow.

2. Modify the my.cf configuration file

Modify the storage directory

[mysqld]

datadir=/home/mysql

socket=/home/mysql/mysql.sock

[mysql_safe]

pid-file=/home/mysql/mysqld.pid

Added

[mysql]

socket=/home/mysql/mysql.sock

3. Be sure to pay attention to modifying the permissions of the data storage directory, especially when

mysql_safe pid home/mysql/mysqld.pid* ended Similar exceptions

Thank you for reading, I hope it can help you, thank you for your support of this site!

You may also be interested in:
  • Two ways of storing scrapy data in MySQL database (synchronous and asynchronous)
  • Python example of storing JSON-like data in MySQL
  • How to install MySQL 5.7 on Ubuntu and configure the data storage path
  • How to change the database data storage directory in MySQL
  • Detailed example of MySQL data storage process parameters
  • How to move mysql5.7.19 data storage location in Centos7
  • Solution to changing the data storage location of the database in MySQL 5.7
  • MySQL database architecture details
  • MySQL spatial data storage and functions

<<:  A brief discussion on why daemon off is used when running nginx in docker

>>:  A brief talk about React Router's history

Recommend

Mysql GTID Mha configuration method

Gtid + Mha + Binlog server configuration: 1: Test...

Solution to ElementUI's this.$notify.close() call not working

Table of contents Requirement Description Problem...

MySQL-group-replication configuration steps (recommended)

MySQL-Group-Replication is a new feature develope...

Install Docker on CentOS 7

If you don't have a Linux system, please refe...

Draw a heart with CSS3

Achieve resultsRequirements/Functionality: How to...

How does Vue implement communication between components?

Table of contents 1. Communication between father...

Alibaba Cloud Ubuntu 16.04 builds IPSec service

Introduction to IPSec IPSec (Internet Protocol Se...

Use CSS to achieve circular wave effect

I often see some circular wave graphics on mobile...

Solution to the problem that the image name is none after Docker load

Recently, I found that after using the docker loa...

Use of TypeScript Generics

Table of contents 1. Easy to use 2. Using generic...

Front-end advanced teaching you to use javascript storage function

Table of contents Preface Background Implementati...

How to successfully retrieve VMware Esxi root password after forgetting it

Prepare a CentOS6 installation disk (any version)...

How to implement insert if none and update if yes in MySql

summary In some scenarios, there may be such a re...