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.
January 4th, 2010 on 5:56 pm
Nice, thank you.