Home >Database >Mysql Tutorial >Example tutorial on modifying data files in mysql5.6.33
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=33062. Stop the mysql service
service mysql stop3. Create directory
mkdir /home/mysql chown -R mysql:mysql /home/mysqlData4. Data file transfer (move the entire /var/lib/mysql to /home/mysqlData)
cp -afir /var/lib/mysql /home/mysqlData5. 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.sock6. Modify the MySQL startup script /etc/init.d/mysqlChange 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!