I'm having issues creating a table for my ruby on rails app. It's driving me crazy! The following is returned when I try to create the table:
我在为ruby on rails应用程序创建表时遇到了问题。当我尝试创建表时,将返回以下内容:
ERROR 1 (HY000): Can't create/write to file '/usr/local/mysql/data/test_development/users.MYI' (Errcode: 2)
错误1 (HY000):无法创建/写入文件'/usr/local/mysql/data/test_development/users。MYI”(Errcode:2)
It's worth mentioning I'm a total newbie, btw.
顺便说一下,值得一提的是我是个新手。
5 个解决方案
#1
9
This forum post seems to deal with the same problem:
这个论坛帖子似乎也在处理同样的问题:
Try the following:
试试以下:
- mkdir /var/lib/mysql/tmp
- mkdir /var/lib/mysql/tmp
- chown mysql:mysql /var/lib/mysql/tmp
- 乔恩mysql:mysql /var/lib/mysql/tmp
- Add the following line into the [mysqld] section: tmpdir = /var/lib/mysql/tmp
- 在[mysqld]部分中添加以下行:tmpdir = /var/lib/mysql/tmp
- Restart the server
- 重新启动服务器
#2
1
I hope you got this resolved as it has been a year. But I just ran into this same problem and resolved it successfully. This error is because mysql does not have permission to modify files in /usr/local/mysql/data. To bypass using this directory, this was to copy out one of the provided cnf in /usr/local/mysql/support-files into ~/.my.cnf. I used my-medium.cnf. Then I added the variable tmpdir=/tmp under the section [mysqld]. I picked /tmp because I have read and write permissions there. Remember to start and restart your mysql server.
我希望你能解决这个问题,因为已经过去一年了。但是我遇到了同样的问题并成功地解决了它。这个错误是因为mysql没有权限修改/usr/local/mysql/data中的文件要绕过这个目录,需要将/usr/local/mysql/support文件中提供的一个cnf复制到~/.my.cnf中。我用my-medium.cnf。然后我在[mysqld]小节下添加了变量tmpdir=/tmp。我选择了/tmp,因为我有读写权限。记得启动并重新启动mysql服务器。
#3
1
I got this error in Windows, and I find out that I rename my DB name similarly. it solved my problem. Hope this helps.
我在Windows中得到了这个错误,我发现我重命名了类似的DB名称。它解决了我的问题。希望这个有帮助。
#4
0
try the following:
试试以下:
1) mkdir /var/lib/mysql/tmp
1)mkdir /var/lib/mysql/tmp
2) chown mysql:mysql /var/lib/mysql/tmp
2)乔恩mysql:mysql /var/lib/mysql/tmp
3) Add the below line into the [mysqld] section of my.cnf: tmpdir = /var/lib/mysql/tmp
3)将下面一行添加到my.cnf的[mysqld]部分:tmpdir = /var/lib/mysql/tmp
4) Restart the server
4)重新启动服务器
#5
0
No need to restart the server
The following can work, and is worth a try: Using root privileges, search /tmp for a file named like #sql_d5_0.MYD If found, just move or delete is. That way you release the lock that keeps mysql from accesing your data. It´s
下面的方法可以工作,值得一试:使用root特权,搜索/tmp,找到一个名为#sql_d5_0的文件。如果找到MYD,只需移动或删除即可。这样就释放了锁,使mysql无法适应您的数据。它´s
sudo rm /tmp/\#sql*
#1
9
This forum post seems to deal with the same problem:
这个论坛帖子似乎也在处理同样的问题:
Try the following:
试试以下:
- mkdir /var/lib/mysql/tmp
- mkdir /var/lib/mysql/tmp
- chown mysql:mysql /var/lib/mysql/tmp
- 乔恩mysql:mysql /var/lib/mysql/tmp
- Add the following line into the [mysqld] section: tmpdir = /var/lib/mysql/tmp
- 在[mysqld]部分中添加以下行:tmpdir = /var/lib/mysql/tmp
- Restart the server
- 重新启动服务器
#2
1
I hope you got this resolved as it has been a year. But I just ran into this same problem and resolved it successfully. This error is because mysql does not have permission to modify files in /usr/local/mysql/data. To bypass using this directory, this was to copy out one of the provided cnf in /usr/local/mysql/support-files into ~/.my.cnf. I used my-medium.cnf. Then I added the variable tmpdir=/tmp under the section [mysqld]. I picked /tmp because I have read and write permissions there. Remember to start and restart your mysql server.
我希望你能解决这个问题,因为已经过去一年了。但是我遇到了同样的问题并成功地解决了它。这个错误是因为mysql没有权限修改/usr/local/mysql/data中的文件要绕过这个目录,需要将/usr/local/mysql/support文件中提供的一个cnf复制到~/.my.cnf中。我用my-medium.cnf。然后我在[mysqld]小节下添加了变量tmpdir=/tmp。我选择了/tmp,因为我有读写权限。记得启动并重新启动mysql服务器。
#3
1
I got this error in Windows, and I find out that I rename my DB name similarly. it solved my problem. Hope this helps.
我在Windows中得到了这个错误,我发现我重命名了类似的DB名称。它解决了我的问题。希望这个有帮助。
#4
0
try the following:
试试以下:
1) mkdir /var/lib/mysql/tmp
1)mkdir /var/lib/mysql/tmp
2) chown mysql:mysql /var/lib/mysql/tmp
2)乔恩mysql:mysql /var/lib/mysql/tmp
3) Add the below line into the [mysqld] section of my.cnf: tmpdir = /var/lib/mysql/tmp
3)将下面一行添加到my.cnf的[mysqld]部分:tmpdir = /var/lib/mysql/tmp
4) Restart the server
4)重新启动服务器
#5
0
No need to restart the server
The following can work, and is worth a try: Using root privileges, search /tmp for a file named like #sql_d5_0.MYD If found, just move or delete is. That way you release the lock that keeps mysql from accesing your data. It´s
下面的方法可以工作,值得一试:使用root特权,搜索/tmp,找到一个名为#sql_d5_0的文件。如果找到MYD,只需移动或删除即可。这样就释放了锁,使mysql无法适应您的数据。它´s
sudo rm /tmp/\#sql*