SQL-ERR 'Can't create/write to file '/tmp/#sql_631_0.MYI'

Forum for questions and support relating to the 1.25.x releases only.
Locked
OH1KH
Posts: 13
Joined: Mon Dec 19, 2011 12:49 pm

SQL-ERR 'Can't create/write to file '/tmp/#sql_631_0.MYI'

Post by OH1KH »

Hi!

Zonemineder has run ok since I got it running. I can't say how long, but found some events from Aug-2012 when I first time tried to solve this problem. So at least 6 months.

Disk is not full, and no changes to permissions has been done.
Server is running fedora 16.
Current mysql version is now: Ver 14.14 Distrib 5.5.29, for Linux (i686) using readline 5.1

When I click events on zm main console, and there are more than just couple events (i.e. Day, Week, Month) I get this error:

SQL-ERR 'Can't create/write to file '/tmp/#sql_631_0.MYI' (Errcode: 2)', statement was 'select E.Id,E.Name,E.StartTime,E.EndTime,E.Length,E.Frames,E.MaxScore,E.Cause,E.Notes,E.Archived,E.MonitorId from Events as E inner join Monitors as M on (E.MonitorId = M.Id) where not isnull(StartTime) and E.StartTime >= '2013-02-15 09:42:50' and E.EndTime >= '2013-02-15 19:00:00' and E.StartTime <= '2013-02-16 08:59:59' order by Id asc'

Some weeks ago I got 2 updates for MySql, within short period from Fedora update.
Very soon after first update this problem started. Only way I found to fix it properly, is to drop zm database completely. (there cant become large queries any more ;)

I did this and got system working again. After that came second update.
I do not remember was there problem 2 times with first update. After the second one came, it looked like everything was ok after that, but now this problem has started again.

When this error is on I can not access zm database at all. Means also with other tools than zm itself.
Just get this error (as root with webmin):
SQL select table_schema,table_name from information_schema.views where table_schema = ? failed : Can't create/write to file '/tmp/#sql_631_0.MYI' (Errcode: 2)

Same problem with all databases, so it seems to be MySql problem rather than Zoneminder's

Just wanted to know if anyone else has got this same problem within 2 latest update from MySql ?

Seems that something has changed with those last 2 updates of MySql. But what?
The errcode 2 does not clearly pinpoint the problem.
There are lots of similar errors found with google, but I have not found right solution yet.
OH1KH
Posts: 13
Joined: Mon Dec 19, 2011 12:49 pm

Re: SQL-ERR 'Can't create/write to file '/tmp/#sql_631_0.MYI

Post by OH1KH »

This is so...

Shorty after writing this I found one solution that MIGHT be good one.

At least queries are working now, without deleting whole zm database.

The problem might be in Fedora's cron that cleans tmp every day.
We'll see that within few days, I think.
( Has this changed within latest updates? As everything worked ok so long, and suddenly stopped to work)

Edit /etc/cron.daily/tmpwatch by adding one line:

/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \
-X '/tmp/systemd-namespace*' \ #<-------------------- THIS LINE
-X '/tmp/hsperfdata_*' 10d /tmp

to prevent tmpwatch to delete MySql's temporary folder from /tmp.
Then restart Mysqld. ----> systemctl restart mysqld.service

Wait and hope the best...

Whole story is found from:
http://stackoverflow.com/questions/1199 ... -what-does

Now just sit and wait...
Locked