Category / Section
How to resolve the "Storage Space Full" error in MySQL
Published:
When encountering a “storage space full” error in MySQL, it is likely due to insufficient space to create temporary files needed by the database. This article will guide you through the steps to resolve this issue.
Checking Storage Space
First, you need to check the storage space allocated to the /tmp directory. You can do this by running the following command:
df -h
This command will display the storage space allocated to each partition, including /tmp.
Solutions
If the /tmp directory is in its own partition and is short of space, you can either:
- Modify
/tmpso that its partition has more space (either by reallocating or moving it to the main partition). - Modify the MySQL configuration file so that it uses a different temp folder on a different partition, e.g.
/var/tmp.
Modifying /tmp Partition
To modify the /tmp partition, you can follow the steps provided in this example: Link to example
Changing MySQL Temp Folder
To change the temp folder used by MySQL, follow these steps:
- Open the MySQL configuration file (usually located at
/etc/my.cnfor/etc/mysql/my.cnf). - Locate the
[mysqld]section in the configuration file. - Add or modify the following line:
Replacetmpdir = /var/tmp/var/tmpwith the desired directory path. - Save the changes and restart the MySQL service.