CentOS6.7 mysql5.6.33 how to modify the data file location,

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.