Home > Database > Mysql Tutorial > body text

Example tutorial on modifying data files in mysql5.6.33

零下一度
Release: 2017-06-29 10:45:01
Original
1386 people have browsed it

Problem: The partition capacity of the data file stored by mysql is small 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 certain disk

3. Modify the data storage location

Steps to modify the data storage location:

1, View mysql Storage directory

##
#安装目录
--basedir=/usr 
#数据存储位置
--datadir=/home/mysqlData/mysql 
#用户
--user=mysql 
#日志
--log-error=/home/mysqlData/mysql/localhost.localdomain.err 
#端口
--port=3306
Copy after login
2. Stop the mysql service

service mysql stop
Copy after login
3. Create directory

mkdir /home/mysql
chown -R mysql:mysql /home/mysqlData
Copy after login
4. Data file transfer (move the entire /var/lib/mysql to /home/mysqlData)

cp -afir /var/lib/mysql /home/mysqlData
Copy after login
5. Modify the MySql configuration document /etc/my.cnf configuration document

[client]

port            = 3306#修改后的目录
socket          = /home/mysqlData/mysql/mysql.sock
[mysqld]

port = 3306default-storage-engine = InnoDB #默认存储引擎
lower_case_table_names = 1 #不区分大小写
max-connections=3000character_set_server=utf8
#修改后的目录
datadir=/home/mysqlData/mysql

#修改后的目录

sock=/home/mysqlData/mysql/mysql.sock
Copy after login
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
Copy after login

7. Start the mysql service

service mysql start
Copy after login

The above is the detailed content of Example tutorial on modifying data files in mysql5.6.33. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template