My problem is short. I have typed

chown -R root:root /var

and my mysql server stopped working :/ I tried searching for the solution, but nothing helped me.

I have also problem with permissions in Phpmyadmin. Errors you can found here.

I know, that i have ruined the whole structure of ownerhsip, so if you have a list of default users and groups in var I would be very gratefull.


That command was harmful. It changed the ownership of all objects (file and directories) inside /var directory to root user. But that is not what some programs expect, including mysql

mysql wants the files inside /var/lib/mysql directory to be owned by the user mysql.

So, you should change the ownership of the directory (recursively) again using this command

sudo chown -R mysql:mysql /var/lib/mysql

Except this file /var/lib/mysql/debian-5.7.flag. That one is owned by root. After executing the above command, you can again change the ownership of this file

sudo chown root:root /var/lib/mysql/debian-5.7.flag

Also mysql wants the its log directory to be owned by mysql user. So, do this again to change ownership of that too

sudo chown -R mysql:mysql /var/log/mysql

Fortuantely, I had phpmyadmin installed. I can give the files list owned by mysql in /var/lib/phpmyadmin directory. Here is the list. Change ownership of all of these using sudo chown mysql:mysql filename command.


I've answered this to fix only mysql related stuff. But if you need to fix all those, you can check these questions

  • @Rinzwind why? where am i doing wrong? – Anwar Oct 27 '16 at 12:19
  • That's working :D But I have one problem more with phpmyadmin "Permission denied" in /var/lib/php/sessions :/ Full error: prntscr.com/czlgo2 – Kryniowesegryderiusz Oct 27 '16 at 12:23
  • @Rinzwind I'm fixing the stuff only in /var/lib/mysql – Anwar Oct 27 '16 at 12:25
  • Is there any list of users and groups in var that now i have to set up? – Kryniowesegryderiusz Oct 27 '16 at 12:27
  • @Kryniowesegryderiusz are you looking for answers for all files and dirs inside /var/ or only mysql? I provided answer only for mysql – Anwar Oct 27 '16 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.