0

I get ErrorCode: 2 which I assume is ENOENT (No such file or directory). Here are the full details (from my stackoverflow post, which was closed by the powers-that-be as being of limited interest. Maybe if I mentioned that the app was to help programmers write in-place-list-reversal functions. But I gather I'm at the right place now). Here are the details...

This happened after I restarted my Linode VPS (which it turns out I didn't need to, but it uncovered this bug).

$ ps auxww | grep mysql
mysql    19755  0.0  4.2 309904 21396 ?        Sl   Mar16  20:50 /usr/libexec/mysqld 
--basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --log-
error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql
/mysql.sock

This looks correct. mysql* are in /usr/bin, and the datadir is correct.

When I start the mysql client with the credentials in database.yml it works as expected. But when I run rails console, at startup I get the error

data_loader.rb failed: Can't create/write to file '/tmp/#sql_4d2b_0.MYI' (Errcode: 2)

It's not a disk-space problem

$ ls -ld /tmp
drwxrwxrwt 11 root root 4096 Apr  1 17:36 /tmp
$ df /tmp
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root       20386924 5496712  14061840  29% /

Here's /etc/my.cnf:

[mysqld]
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under different user or group, 
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

And all that /etc/rc.d/init.d/mysqld does is run service mysqld start and .... stop (yes, this is on Fedora Core).

This is with Rails 3.0.8 on Ruby 1.9.2p320

Anything else? Nothing in /var/log/mysqld.log

4
  • 1
    and did you check df -i ?
    – cstamas
    Apr 2, 2013 at 18:05
  • Thanks for the note. Plenty of inodes to spare -- /tmp is only using 13%. Note that when I run the mysql client I can access the db; I only get this error via rails and the mysql-ruby bridge/the activerecord orm, or whatever else is going on.
    – Eric
    Apr 2, 2013 at 22:23
  • Fedora Core what? Apr 3, 2013 at 16:10
  • Fedora release 16 (Verne)
    – Eric
    Apr 3, 2013 at 20:14

2 Answers 2

0

Not too long ago I was dealing with the same error and I found out that some of my BIG queries were creating a lot of temp files because of (group by, order by, Join,...) on the disk under /tmp. during this time if another request would have called the queries then it was erring out due to the fact /tmp was running out of space. I looked everywhere for the solution and the only one was to increase the size of /tmp and tune couple of server variables and it got resolved. I had MySQL 5.1 which later I upgrade it to 5.5. I hope this will help you.

2
  • Thanks for the reply, but if that was the case, wouldn't I get an errorcode 28 (ENOSPC) rather than 2 (ENOENT) ? In this case, /tmp is on the same partition as /, and df /tmp => /dev/root 20386924 5487412 14071140 29% /
    – Eric
    Apr 3, 2013 at 20:16
  • My solution is to just reinstall ruby and the gems I use -- it looks like a gem I rely on got contaminated during a recent upgrade/retreat/upgrade cycle.
    – Eric
    Apr 3, 2013 at 20:17
0

The answer is at https://stackoverflow.com/questions/11997012/mysql-cant-create-write-to-file-tmp-sql-3c6-0-myi-errcode-2-what-does

On Fedora mysqld is assigned its own mounted /tmp partition, and a separate process harvests unused partitions. My server's been relatively quiet lately, so the partition was removed, and mysql could no longer run 'show full fields from [table]'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .