MySQL error 1 (HY000) Error creating file Errcode 2

I am having trouble creating a table for my ruby ​​on rails. It drives me crazy! When trying to create a table, the following is returned:

ERROR 1 (HY000): Unable to create / write to file '/usr/local/mysql/data/test_development/users.MYI' (Errcode: 2)

It's worth mentioning that I'm a complete newbie by the way.

+2


source to share


5 answers


This forum post seems to address the same issue:



Try the following:

  • mkdir / var / lib / mysql / tmp
  • chown mysql: mysql / var / lib / mysql / tmp
  • Add the following line to the [mysqld] section: tmpdir = / var / lib / mysql / tmp
  • Reboot the server
+9


source


I hope you decided that a year has passed. But I ran into this problem and solved it successfully. This error is due to mysql not having permission to modify files in / usr / local / mysql / data. To get around this directory, one had to copy one of the provided cnf files to / usr / local / mysql / support -files to ~ / .my.cnf. I used my-medium.cnf. Then I added the tmpdir = / tmp variable in the [mysqld] section. I chose / tmp because I have read and write permissions. Don't forget to start and restart the mysql server.



+1


source


I got this error on Windows and I found out that I am renaming my database name the same way. it solved my problem. Hope this helps.

+1


source


try this:

1) mkdir / var / lib / mysql / tmp

2) chown mysql: mysql / var / lib / mysql / tmp

3) Add the line below to the [mysqld] section of my.cnf:     tmpdir = / var / lib / mysql / tmp

4) Reboot the server

0


source


No need to restart the server

The following may work and are worth trying: Using root privileges, search / tmp for a file named # sql_d5_0.MYD If found, just move or delete. This is how you release the lock that allows mysql to access your data. Winked

sudo rm /tmp/\#sql*

      

0


source







All Articles