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

jQuery implements form validation

Use jQuery to implement form validation, for your...

Use of VNode in Vue.js

What is VNode There is a VNode class in vue.js, w...

How to enable TLS and CA authentication in Docker

Table of contents 1. Generate a certificate 2. En...

9 Practical CSS Properties Web Front-end Developers Must Know

1. Rounded Corners Today's web designs are con...

About Vue virtual dom problem

Table of contents 1. What is virtual dom? 2. Why ...

Detailed process of NTP server configuration under Linux

Table of contents 1. Environment Configuration 1....

What are the differences between var let const in JavaScript

Table of contents 1. Repeated declaration 1.1 var...

Summary of common optimization operations of MySQL database (experience sharing)

Preface For a data-centric application, the quali...

HTML4.0 element default style arrangement

Copy code The code is as follows: html, address, ...

Node.js+express+socket realizes online real-time multi-person chat room

This article shares the specific code of Node.js+...