Mirage
Mirage

Reputation: 31548

MySQL can't write to temp directory

I tried everything and whenever i try to start mysql i get this error

140526 18:21:36 InnoDB: Using Linux native AIO
^G/usr/sbin/mysqld: Can't create/write to file '/mysql/ibAlmthH' (Errcode: 13)

I even tried to chnage tmp dir in my.cnf with full write permissions but i still get that error

I tried this post

https://stackoverflow.com/a/16178696

But still same error

what should i do

Upvotes: 1

Views: 4026

Answers (3)

Aman Aggarwal
Aman Aggarwal

Reputation: 18429

Refer this, from the stackoverflow question number-2783313 may it help:

Recent Ubuntu Server Editions (such as 10.04) ship with AppArmor and MySQL's profile might be in enforcing mode by default. You can check this by executing sudo aa-status like so:

# sudo aa-status
5 profiles are loaded.
5 profiles are in enforce mode.
   /usr/lib/connman/scripts/dhclient-script
   /sbin/dhclient3
   /usr/sbin/tcpdump
   /usr/lib/NetworkManager/nm-dhcp-client.action
   /usr/sbin/mysqld
0 profiles are in complain mode.
1 processes have profiles defined.
1 processes are in enforce mode :
   /usr/sbin/mysqld (1089)
0 processes are in complain mode.

If mysqld is included in enforce mode, then it is the one probably denying the write. Entries would also be written in /var/log/messages when AppArmor blocks the writes/accesses. What you can do is edit /etc/apparmor.d/usr.sbin.mysqld and add /data/ and /data/* near the bottom like so:

...
/usr/sbin/mysqld {
    ...
    /var/log/mysql/ r,
    /var/log/mysql/* rw,
    /var/run/mysqld/mysqld.pid w,
    /var/run/mysqld/mysqld.sock w,
    /data/ r,
    /data/* rw,
}

And then make AppArmor reload the profiles.

# sudo /etc/init.d/apparmor reload

WARNING: the change above will allow MySQL to read and write to the /data directory. We hope you've already considered the security implications of this.

Upvotes: 4

M. Adel
M. Adel

Reputation: 407

Try to run this command manually:

touch /mysql/ibAlmthH

If it failed to create it, you then have a filesystem problem, e.g. read-only filesystem, So you need to fix the filesystem problem first, Also check the available disk space on this directory, may be there is no space.

Upvotes: 1

Aman Aggarwal
Aman Aggarwal

Reputation: 18429

Change directory permission to read, write and execute..

Chmod 777 /directory_path

Upvotes: -1

Related Questions