Andrew Beaton :: FAQ

Can’t create table – errno: 13

by Andrew on Dec.30, 2009, under Linux, MySQL, SQL

I came across a problem today when trying to create a temporary table in MySQL.

ERROR 1005 (HY000): Can't create table 'temptable' (errno: 13)

The first thing I checked was that the user in question had the Create_tmp_table_priv privilege in the users table, which it did.

The next step was to find out where MySQL was writing the temporary tables.

The following command tells us this:

show variables like '%dir';
+---------------------------+----------------------------+
| Variable_name             | Value                      |
+---------------------------+----------------------------+
| basedir                   | /usr/                      |
| bdb_logdir                |                            |
| bdb_tmpdir                | /tmp/                      |
| character_sets_dir        | /usr/share/mysql/charsets/ |
| datadir                   | /var/lib/mysql/            |
| innodb_data_home_dir      |                            |
| innodb_log_arch_dir       |                            |
| innodb_log_group_home_dir | ./                         |
| slave_load_tmpdir         | /tmp/                      |
| tmpdir                    | /tmp/                      |
+---------------------------+----------------------------+

And from that we see the tmpdir is located in /tmp/.

A quick checked revealed that MySQL could not create files in this directory, no write access, so a simple permissions change and all was well again.

:, ,
1 comment for this entry:

Leave a Reply

Powered by WP Hashcash

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

 

Archives

All entries, chronologically...