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

Mobile development tutorial: Summary of pixel display issues

Preface I believe that in the process of mobile t...

Summary of several error logs about MySQL MHA setup and switching

1: masterha_check_repl replica set error replicat...

File upload via HTML5 on mobile

Most of the time, plug-ins are used to upload fil...

Practical record of handling MySQL automatic shutdown problems

I recently helped someone with a project and the ...

Install Python virtual environment in Ubuntu 18.04

For reference only for Python developers using Ub...

React native ScrollView pull down refresh effect

This article shares the specific code of the pull...

MySQL 8.0.21 installation tutorial with pictures and text

1. Download the download link Click download. You...

How to build Apr module for tomcat performance optimization

Preface Tomcat is a widely used Java web containe...

A Brief Analysis of CSS Selector Grouping

Selector Grouping Suppose you want both the h2 el...

Detailed analysis of GUID display issues in Mongodb

Find the problem I recently migrated the storage ...