Insufficient disk space in the Data Directory

Source: Internet
Author: User

After many systems are officially launched, as the amount of data increases, the available space in the data directory will become smaller and smaller, leading to security risks. For such problems, you can take different measures based on different situations.

For MyISAM engine tables, when creating tables, you can use the following options to specify the data directory And index directory to store them in different disk spaces. By default, they are stored in the data directory.

For example

Create Table T1 (ID int, name varchar (10) data directory = '/var/lib/MySQL/data' index directory ='/var/lib/MySQL/Index ';

Can these paths be changed at any time during use? The answer is no,

Alter table T1 index directory = '/var/lib/MySQL/data' ------------------------------ is it successful?

In this case, if the table has been created, you can also move the data files and index files of the table to a sufficient partition on the disk, and then create a symbolic link in the original file. Of course, you must stop or lock the table before the music video to prevent table changes.

 

**************************************** *********************************

For InnoDB tables that store engines, data files and index files are stored together, so they cannot be separated. When disk space is insufficient, you can add a new data file on a disk with sufficient space. The specific implementation method is to add this file to the innodb_data_file_path parameter, and write the path to the absolute path of the new disk, for example, if the space in/home is insufficient and you want to add a file under home1 that can automatically expand the data, you can write the parameter as follows:

Innodb_data_file_path =/home/iddata1: 2000 m;/home1/ibdata2: 2000 m: autoextend

After modifying the parameters, restart the database to take effect.

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.