cancel
Showing results for 
Search instead for 
Did you mean: 

DB query failed: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/var/tmp/#sql_381_0.M

DB query failed: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/var/tmp/#sql_381_0.M

i have facing the issue now like.


DB query failed: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/var/tmp/#sql_381_0.MAI' (Errcode: 28), query was: DESCRIBE `sessions`

 

that's why Magento 1.x admin panel and frontend not working.

admin panel not logged in.

Image_URL

My site is inaccessible. please give me some suggestions on this issue.

or should I need to concern with the hosting provider for this?

Screenshot from 2022-01-04 10-42-18.png

2 REPLIES 2

Re: DB query failed: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/var/tmp/#sql_381

The problem can be connected with inodes. Maybe you have too many small files and your inodes are full. You can check inode status with df -i.
Sometimes when this error happens with temp tables:

#126 - Incorrect key file for table '/tmp/#sql_64d_0.MYI'; try to repair it
Or it can be connected with /tmp folder. Please see this answer.

If issue solved, Click Kudos & Accept as Solution.
LitCommerce - The Most Simple & Affordable Multi-channel Selling Tool

Re: DB query failed: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/var/tmp/#sql_381

Hello R K Solanki,

 

I hope you are doing well!

 

The error message above can be due to two reasons, i.e., /tmp partition has run out of space, and the file couldn't be created for some reason. Secondly, the mysqld process cannot write to that directory because of permission problems.

 

You can try the steps below in order to fix this issue,

 

1. Check Mysql config: my.cnf

 cat /etc/my.cnf | grep tmpdir

In my.cnf

2. add tmpdir=/tmp to my.cnf under [mysqld]

3. restart web/app and mysql server

/etc/init.d/mysqld restart

 

You will have to set the MySQL config variable tmpdir to a directory on another disk partition with more space.

 

Furthermore, you will have to grant the /tmp folder as 777 permission. You can use the following command to grant permission chmod -R 777 /tmp

 

You can also restart the mysqld service with the following command, systemctl start mysqld.service

 

Now, on restarting the service, mysqld works because it starts everything over again with a fresh start, with a brand new private /tmp directory.

 

In order to solve the issue, you also have to configure /bin/systemd-tmpfiles. 

 

The MySQL DB service will be up and running when you give permission to temp tables, clear the inodes, and restart the mysqld service.

 

I hope it helps you to overcome this error.

 

------------------

Regards,

Rex M