!!! Problem

If you're trying to write to a file in MySQL, you can get an error which says

Can't create/write to file <filename>

If you're doing this from Python, you can get aa mysql_exceptions.InternalError Errcode 13.

This may be because AppArmor is preventing the write.

!!! Fix

If you want be to write recursively to a particular path and are using Ubuntu -


/usr/sbin/mysqld {
  /path/to/write/to/** rw,

to the file


and restart apparmor

$ sudo /etc/init.d/apparmor restart

If you just want to specify a particular file, you can omit the {{/**}}.

[Linux | CategoryComputing.Linux] - [Python | CategoryComputing.Lang.Python] - [MySQL | CategoryComputing.DB.SQL.MySQL]