CentOS6.7 mysql5.6.33 how to modify the data file location,
Problem: mysql cannot connect to the data files stored in mysql because the partition capacity is small and full,
Solution:
1. Delete unnecessary data in a partition, such as log files. (the root problem cannot be solved)
2. Resize a disk
3. Modify the data storage location
To modify the data storage location, follow these steps:
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 the mysql service.
Service mysql stop
3. Create a directory
mkdir /home/mysqlchown -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 configuration file/etc/my. cnf of MySql.
[Client] port = 3306 # The modified directory socket =/home/mysqlData/mysql. sock [mysqld] port = 3306default-storage-engine = InnoDB # default storage Engine Memory = 1 # case insensitive max-connections = 3000character_set_server = utf8 # The modified directory datadir =/home/mysqlData/mysql # The modified directory sock =/home/mysqlData/mysql. sock
6. Modify the MySQL STARTUP script/etc/init. d/mysql
Change the datadir entry 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 section describes how to modify the location of a data file in CentOS6.7 mysql5.6.33. I hope it will help you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!