Mysql can't write to new tmpdir

I'm running a large query. (http://www.experts-exchange.com/Programming/Languages/SQL_Syntax/Q_25747438.html#a30091847) which fails because I run out of disc space.

/mnt has lots of freespace.
I tried creating a new tmpdir

# mkdir /mnt/mysqltmp
# chown mysql /mnt/mysqltmp
# chmod 777 /mnt/mysqltmp
# ls -l /mnt/mysqltmp
drwx------ 2 root  root 16384 2009-10-15 18:16 lost+found
drwxrwxrwx 2 mysql root  4096 2010-04-08 08:21 mysqltmp

Yet when I now run queries, I get:
ERROR 1 (HY000): Can't create/write to file '/mnt/mysqltmp/#sql_1628_0.MYI' (Errcode: 13)
# perror 13
OS error code  13:  Permission denied

Why do I get permission denied?
LVL 6
letharionAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cjl7freelance for hireCommented:
Hi,
If you are using ubuntu or Red Hat you might be hit by app-armor and SELinux.

Just mount your mysqltemp in /var/lib/mysql instead and you should be smiling.

Any other "world-writable" directory is fine as well, say /var/tmp/mysqltemp would also work "out of the box".

//jonas
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
arminelCommented:
Hi,

Your /mnt directory must have read and execute permissions for the application to get to /mnt/mysqltmp/ directory.

It's like this: you can't get to level 2 if you don't pass through level 1 first :)
0
letharionAuthor Commented:
>Your /mnt directory must have read and execute permissions for the application to get to /mnt/mysqltmp/ directory.
Good point, I hadn't thought about this, but /mnt is also 777, so that's not it.

>Just mount your mysqltemp in /var/lib/mysql instead and you should be smiling.
Yes!
mount --bind /mnt/mysqltmp /var/lib/mysql/mysqltmp
fixed it. I am smiling ^^
Ty
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.