CentOS6.7 mysql5.6.33 modify the data file location, centos7 install mysql5.6
Problem: Mysql stores data files with a Small Partition capacity that is currently full, resulting in mysql connection failure,
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