日期:2014-05-16  浏览次数:20404 次

mysql 错误,SQL/DB Error errcode 13 Can't create/write to file
SQL/DB Error errcode 13 Can't create/write to file 错误

是因为临时目录没有可写权限,
配置文件,tmpdir=/tmp 的目录有可写权限就可以

////////////////////////

How do I fix the following error SQL/DB Error errcode 13 Can't create/write to file?
Problem: The MySQL variable tmpdir is set to a directory that cannot be written to when using PHP to access MySQL.

To verify this, enter MySQL at the command line and type show variables;

You'll get a long list and one of them will read: tmpdir = /somedir/ (whatever your setting is.)

Solution: Alter the tmpdir variable to point to a writable directory.

Steps:


Find the my.cnf file. On *nix systems this is usually in /etc/.
Once found, open this in a simple text editor and find the [mysqld] section.
Under this section, find the tmpdir line. If this line is commented (has a # at the start), delete the # and edit the line so that it reads: tmpdir = /writable/dir where /writable/dir is a directory to which you can write. Some use /tmp, or you might also try /home//.
Save the file.
Shutdown MySQL by typing mysqlshutdown -u -p shutdown.
Start MySQL by going to the MySQL directory and typing ./bin/safe_mysqld &. Usually the MySQL directory is in /usr/local or sometimes in /usr/ on Linux systems.

If none of this make sense and you have someone to administrate your system for you, show the above to them and they should be able to figure it out.



by tongchao
add  to my.ini
tmpdir = /somedir/