The contents of datadir is typically owned by the mysql user and group. Certain attributes on the datadir itself (ls -ld $datadir) can affect the permissions of newly-created files and directories. You need to talk to you sysadmin, with a eye towards doing something like
chown -R mysql:mysql $datadir I honestly cannot think of a scenario where the datadir should be permissioned any other way. On 2012-10-29 6:26 AM, "javad bakhshi" <javadbakh...@yahoo.com> wrote: Hi, I get an Unknown database error when I am trying to connect to mysql using C API. I have created the database in mysql prompt as root: CREATE DATABASE Lr0; I am pretty sure that the problem is a ownership issue, because when I do ls -l in my datadir I get: [javad64@udbl64 data]$ ls -l total 20532 -rw-rw---- 1 javad64 mysql 10485760 Oct 26 14:10 ibdata1 -rw-rw---- 1 javad64 mysql 5242880 Oct 26 14:10 ib_logfile0 -rw-rw---- 1 javad64 mysql 5242880 Oct 19 15:28 ib_logfile1 drwx------ 2 javad64 javad64 4096 Oct 26 14:35 Lr0 drwx------ 2 javad64 mysql 4096 Oct 22 11:04 mysql drwx------ 2 javad64 mysql 4096 Oct 22 11:04 test which shows Lr0 doesn't have mysql ownership. my question is: 1- Why does this happen? While I am creating the database in mysql prompt as root. 2- How can I fix it? I don't have root access in the system I am using so the chown solution is off table. Best regards, Javad Bakhshi, Computer Science M.Sc Department of IT, Uppsala University