How to move mysql5.7.19 data storage location in Centos7

How to move mysql5.7.19 data storage location in Centos7

Scenario: As the amount of data increases, the disk where MySQL is located is full, and the data needs to be moved to a disk with larger space.

method:

1. Shut down the mysql service

service mysqld stop

2. Move the data directory to a disk with larger space

cp -a /usr/local/mysql/data/ /home/mysqldata/

-a: equivalent to -pdr (parameters pdr are: retain permissions, copy the soft link itself, recursive copy);

3. Modify the configuration file my.cnf

... 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
basedir = /usr/local/mysql 
#datadir = /usr/local/mysql/data 
datadir = /home/mysqldata/data 
#log-error = /usr/local/mysql/data/mysql_error.log 
log-error = /home/mysqldata/data/mysql_error.log 
#pid-file = /usr/local/mysql/data/mysql.pid 
pid-file = /home/mysqldata/data/mysql.pid 
 
#socket =/usr/local/mysql/data/mysql.sock 
socket = /tmp/mysql.sock 
port=3701 
...

4. Start the mysql service

service mysqld stop

Summarize

The above is the Centos7 mobile mysql5.7.19 data storage location introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor 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:
  • 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 implement Mysql switching data storage directory
  • 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 the alternative method of $refs in vue2 in vue3 combined API

>>:  Introduction to the use and disabling of transparent huge pages in Linux

Recommend

Install Kafka in Linux

Table of contents 1.1 Java environment as a prere...

6 solutions to IDEA's inability to connect to the MySQL database

This article mainly introduces 6 solutions to the...

MySQL InnoDB MRR Optimization Guide

Preface MRR is the abbreviation of Multi-Range Re...

Introduction to the use of MySQL official performance testing tool mysqlslap

Table of contents Introduction Instructions Actua...

Write a React-like framework from scratch

Recently I saw the article Build your own React o...

mysql method to recursively search for all child nodes of a menu node

background There is a requirement in the project ...

Introduction to Jenkins and how to deploy Jenkins with Docker

1. Related concepts 1.1 Jenkins Concepts: Jenkins...

User Experience Summary

Nowadays, whether you are working on software or w...

Vue uses three methods to refresh the page

When we are writing projects, we often encounter ...

Detailed explanation of Vue3 sandbox mechanism

Table of contents Preface Browser compiled versio...

Docker installation tomcat dubbo-admin instance skills

1. Download the tomcat image docker pull tomcat:8...

JS code to achieve page switching effect

This article example shares the specific code of ...

How to delete node_modules and reinstall

Table of contents Step 1: Install node_modules in...