开发者

Mysql through PHP gives a "Can't create/write to file" error

开发者 https://www.devze.com 2022-12-22 21:30 出处:网络
The full error is: Message: Mysqli statement execute error : Can\'t create/write to file \'/var/www/zendApp/backup/mysql/1268733580_name.sql\'

The full error is:

Message: Mysqli statement execute error : Can't create/write to file '/var/www/zendApp/backup/mysql/1268733580_name.sql' (Errcode: 13)

I have tried several things already with the /var/www/ZendApp/backup/mysql directory

$chmod 777 mysql
$chmod 1777 mysql
$chown root:root mysql
$chown mysql:mysql mys开发者_JAVA百科ql

But nothing helps. What am I doing wrong here? Do I have to tell mysql somewhere that I can write to that directory?


With the help off Dominik @ Super User, I discovered that Ubuntu is running apparmor and my server is running on Ubuntu. I quote from wikipedia:

AppArmor allows the system administrator to associate with each program a security profile that restricts the capabilities of that program

Sure enough, among those programs was mysqld. So not the user or his privileges are the problem, but the restrictions imposed on the process by apparmor. I then found the solution here

sudo touch /etc/apparmod.d/disable/usr.sbin.mysqld
sudo /etc/init.d/apparmor reload

This makes mysqld a free process which for me, on that server, is no problem. So, after days of searching, problem fixed!

0

精彩评论

暂无评论...
验证码 换一张
取 消