1

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.

  • also see http://askubuntu.com/questions/343245/default-user-group-owner-for-var-folder – Rinzwind Oct 27 '16 at 12:38
  • even better: see http://unix.stackexchange.com/questions/49959/how-to-restore-default-group-user-ownership-of-all-files-under-var – Rinzwind Oct 27 '16 at 12:39
  • Please consider providing text outputs instead of screenshots. It helps finding the question and improves formatting. Thanks – Anwar Oct 27 '16 at 12:46

1 Answers1

2

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.

/var/lib/mysql/phpmyadmin 
/var/lib/mysql/phpmyadmin/pma__table_uiprefs.ibd 
/var/lib/mysql/phpmyadmin/pma__bookmark.frm 
/var/lib/mysql/phpmyadmin/pma__pdf_pages.ibd 
/var/lib/mysql/phpmyadmin/pma__usergroups.ibd 
/var/lib/mysql/phpmyadmin/pma__savedsearches.ibd 
/var/lib/mysql/phpmyadmin/pma__designer_settings.ibd 
/var/lib/mysql/phpmyadmin/pma__relation.ibd 
/var/lib/mysql/phpmyadmin/pma__export_templates.ibd 
/var/lib/mysql/phpmyadmin/pma__favorite.frm 
/var/lib/mysql/phpmyadmin/pma__column_info.ibd 
/var/lib/mysql/phpmyadmin/pma__userconfig.ibd 
/var/lib/mysql/phpmyadmin/pma__users.frm 
/var/lib/mysql/phpmyadmin/pma__relation.frm 
/var/lib/mysql/phpmyadmin/pma__table_coords.frm 
/var/lib/mysql/phpmyadmin/pma__navigationhiding.frm 
/var/lib/mysql/phpmyadmin/pma__column_info.frm 
/var/lib/mysql/phpmyadmin/pma__history.frm 
/var/lib/mysql/phpmyadmin/pma__userconfig.frm 
/var/lib/mysql/phpmyadmin/pma__tracking.frm 
/var/lib/mysql/phpmyadmin/pma__export_templates.frm 
/var/lib/mysql/phpmyadmin/pma__users.ibd 
/var/lib/mysql/phpmyadmin/pma__table_coords.ibd 
/var/lib/mysql/phpmyadmin/pma__table_info.ibd 
/var/lib/mysql/phpmyadmin/pma__table_info.frm 
/var/lib/mysql/phpmyadmin/pma__savedsearches.frm 
/var/lib/mysql/phpmyadmin/pma__central_columns.frm 
/var/lib/mysql/phpmyadmin/pma__central_columns.ibd 
/var/lib/mysql/phpmyadmin/pma__history.ibd 
/var/lib/mysql/phpmyadmin/pma__favorite.ibd 
/var/lib/mysql/phpmyadmin/pma__table_uiprefs.frm 
/var/lib/mysql/phpmyadmin/pma__recent.ibd 
/var/lib/mysql/phpmyadmin/pma__usergroups.frm 
/var/lib/mysql/phpmyadmin/pma__navigationhiding.ibd 
/var/lib/mysql/phpmyadmin/pma__bookmark.ibd 
/var/lib/mysql/phpmyadmin/pma__designer_settings.frm 
/var/lib/mysql/phpmyadmin/pma__tracking.ibd 
/var/lib/mysql/phpmyadmin/pma__pdf_pages.frm 
/var/lib/mysql/phpmyadmin/pma__recent.frm 
/var/lib/mysql/phpmyadmin/db.opt 

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

Anwar
  • 76,649