How to modify the location of data files in CentOS6.7 mysql5.6.33

How to modify the location of data files in CentOS6.7 mysql5.6.33

Problem: The partition where MySQL stores data files has a small capacity and is currently full, causing MySQL to be unable to connect.

Solution:

1. Delete unnecessary data in the partition, such as log files, etc. (cannot solve the fundamental problem)

2. Expand the capacity of a disk

3. Modify the data storage location

To modify the data storage location:

1. View the mysql storage directory

#Installation directory --basedir=/usr
#Data storage location --datadir=/home/mysqlData/mysql
#User --user=mysql
#Log --log-error=/home/mysqlData/mysql/localhost.localdomain.err
#Port --port=3306

2. Stop MySQL service

service mysql stop

3. Create a directory

mkdir /home/mysql
chown -R mysql:mysql /home/mysqlData

4. Data file transfer (move the entire /var/lib/mysql to /home/mysqlData)

cp -afir /var/lib/mysql /home/mysqlData

5. Modify the MySql configuration document /etc/my.cnf configuration document

[client]
port = 3306
#Modified directory socket = /home/mysqlData/mysql/mysql.sock
[mysqld]
port = 3306
default-storage-engine = InnoDB #Default storage engine lower_case_table_names = 1 #Not case sensitive max-connections = 3000
character_set_server=utf8
#The modified directory datadir=/home/mysqlData/mysql
#The modified directory sock=/home/mysqlData/mysql/mysql.sock

6. Modify the MySQL startup script /etc/init.d/mysql

Change the datadir item in the /etc/init.d/mysql file to /home/mysqlData/mysql

vim /etc/init.d/mysql 

7. Start mysql service

service mysql start

The above is the method I introduced to you to modify the location of the data file in CentOS6.7 mysql5.6.33. I hope it will be helpful to you. If you have any questions, please leave me a message and I 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:
  • Python3 implements the method of writing local JSON big data files into MySQL database
  • How to view the storage location of MySQL data files
  • MySQL database migration example by copying data files
  • How to import csv format data file solution into MySQL
  • Using SQL statements to solve the problem of importing large data files into MySQL
  • An illegal shutdown caused the MySQL data table to be damaged.
  • Summary of Cause Analysis and Repair Methods for MYSQL Table Damage (Recommended)
  • Solve the problem that the MySQL database crashes unexpectedly, causing the table data file to be damaged and unable to start

<<:  Detailed explanation of the role of brackets in AngularJS

>>:  Some major setting modification records when upgrading from kubernetes1.5.2 to kubernetes1.10

Recommend

Implementation of interactive data between QT and javascript

1. Data flows from QT to JS 1. QT calls the JS fu...

How to write asynchronous tasks in modern JavaScript

Preface In this article, we'll explore the ev...

Regular expression usage in CSS selectors

Yes, CSS has regular expressions too (Amen) Two p...

Analysis of multi-threaded programming examples under Linux

1 Introduction Thread technology was proposed as ...

HTML+Sass implements HambergurMenu (hamburger menu)

A few days ago, I watched a video of a foreign gu...

Detailed explanation of mysql backup and recovery

Preface: The previous articles introduced the usa...

A brief discussion on VUE uni-app custom components

1. Parent components can pass data to child compo...

Tips for implementing multiple borders in CSS

1. Multiple borders[1] Background: box-shadow, ou...

How to clear floating example code in css

Overview The framework diagram of this article is...

HTML is the central foundation for the development of WEB standards

HTML-centric front-end development is almost what ...

HTML tag full name and function introduction

Alphabetical DTD: Indicates in which XHTML 1.0 DT...