Home >Database >Mysql Tutorial >Example tutorial on modifying data files in mysql5.6.33

Example tutorial on modifying data files in mysql5.6.33

零下一度
零下一度Original
2017-06-29 10:45:011407browse

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
2. Stop the mysql service

service mysql stop
3. Create 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#修改后的目录
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
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 the mysql service

service mysql start

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!

Statement:
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