Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't create/write to file - Error code 13 in linux

Iam trying to create a mysql table in linux with changing data directory to another location. The selected forlder having full permission. But I got an error 'Can't create/write to file'. I googled and found that this error related to permission denied. I can change the owner permission of the folder to root using chown command. But it still showing the same error.

mysql> create table test_table( testId int PRIMARY KEY,  testName VARCHAR(20) ) DATA DIRECTORY = '/home/Test/Sample/data';

ERROR 1 (HY000): Can't create/write to file '/home/Test/Sample/data/test_table1.MYD' (Errcode: 13)

What I can do??? Please give me any valuable suggestions....

like image 493
Haseena Avatar asked Sep 26 '12 05:09

Haseena


1 Answers

mysql> create table test_table( testId int PRIMARY KEY,  testName VARCHAR(20) ) 
       DATA DIRECTORY = '/home/Test/Sample/data';

Write as:

mysql> create table test_table( testId int PRIMARY KEY,  testName VARCHAR(20) ) 
       DATA DIRECTORY = '/tmp/data';

To make life easier do try storing to the '/tmp' directory as mysql has access to this directory rather than fumbling around with (chown) changing ownership.

like image 108
Jones Agyemang Avatar answered Sep 18 '22 12:09

Jones Agyemang