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

Example code of layim integrating right-click menu in JavaScript

Table of contents 1. Effect Demonstration 2. Impl...

MySQL 5.7.24 installation and configuration method graphic tutorial

MySQL is the most popular relational database man...

A complete record of a Mysql deadlock troubleshooting process

Preface The database deadlocks I encountered befo...

How to understand the difference between ref toRef and toRefs in Vue3

Table of contents 1. Basics 1.ref 2. toRef 3. toR...

React Router 5.1.0 uses useHistory to implement page jump navigation

Table of contents 1. Use the withRouter component...

MySQL 8.0.22 decompression version installation tutorial (for beginners only)

Table of contents 1. Resource download 2. Unzip t...

JS realizes the calculation of the total price of goods in the shopping cart

JS calculates the total price of goods in the sho...

A brief discussion on the efficiency of MySQL subquery union and in

Recent product testing found a problem that when ...

Take you to understand the event scheduler EVENT in MySQL

The event scheduler in MySQL, EVENT, is also call...

Layim in javascript to find friends and groups

Currently, layui officials have not provided the ...

Detailed explanation of DOM style setting in four react components

1. Inline styles To add inline styles to the virt...

Implementation of Docker deployment of Django+Mysql+Redis+Gunicorn+Nginx

I. Introduction Docker technology is very popular...

WeChat applet canvas implements signature function

In the WeChat applet project, the development mod...

Newbies quickly learn the steps to create website icons

<br />Original URL: http://www.lxdong.com/po...