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

Unity connects to MySQL and reads table data implementation code

The table is as follows: Code when Unity reads an...

How to use ECharts in WeChat Mini Programs using uniapp

Today, we use uniapp to integrate Echarts to disp...

Linux sftp command usage

Concept of SFTP sftp is the abbreviation of Secur...

Docker installs Elasticsearch7.6 cluster and sets password

Starting from Elasticsearch 6.8, free users are a...

Deployment and configuration of Apache service under Linux

Table of contents 1 The role of Apache 2 Apache I...

Linux traceroute command usage detailed explanation

Traceroute allows us to know the path that inform...

Steps to transfer files and folders between two Linux servers

Today I was dealing with the issue of migrating a...

How to restore a single database or table in MySQL and possible pitfalls

Preface: The most commonly used MySQL logical bac...

A brief discussion on Axios's solution to remove duplicate requests

Table of contents 1. Cancel duplicate requests 2....

Raspberry Pi msmtp and mutt installation and configuration tutorial

1. Install mutt sudo apt-get install mutt 2. Inst...

Understand the basics of Navicat for MySQL in one article

Table of contents 1. Database Operation 2. Data T...

Two methods to implement Mysql remote connection configuration

Two methods to implement Mysql remote connection ...

Will CSS3 really replace SCSS?

When it comes to styling our web pages, we have t...