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

Advanced and summary of commonly used sql statements in MySQL database

This article uses examples to describe the common...

...

Detailed explanation of Vue's monitoring method case

Monitoring method in Vue watch Notice Name: You s...

Solution to the problem that Docker container cannot access Jupyter

In this project, the Docker container is used to ...

Graphic tutorial on installing Ubuntu 18.04 on VMware 15 virtual machine

In the past few years, I have been moving back an...

JavaScript to implement voice queuing system

Table of contents introduce Key Features Effect d...

How to submit the value of a disabled form field in a form Example code

If a form field in a form is set to disabled, the ...

Detailed explanation of how to synchronize data from MySQL to Elasticsearch

Table of contents 1. Synchronization Principle 2....

How to use yum to configure lnmp environment in CentOS7.6 system

1. Installation version details Server: MariaDB S...

Modify the default scroll bar style in the front-end project (summary)

I have written many projects that require changin...

About Vue virtual dom problem

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

Web Design Experience: Efficiently Writing Web Code

Originally, this seventh chapter should be a deep ...

CSS inheritance method

Given a div with the following background image: ...

Simply learn various SQL joins

The SQL JOIN clause is used to join rows from two...

JS, CSS style reference writing

CSS: 1. <link type="text/css" href=&q...