Ubuntu – Thesql-workbench: Error log Permission denied

MySQLpermissions

I recently installed mysql-workbench by installing first apt-config.deb from mysql website and then install the actuall mysql with sudo apt-get install mysql-workbenh (I used sudo for almost everything). When I run the program I get errors in the console like this:

Exception in logger: Could not create directory /home/nosthertus/.mysql/workbench/log: Permission denied

Ready.

I/O error : Permission denied
I/O error : Permission denied

For a moment I thought I just don't have permission to write/execute in .mysql folder, so to check I executed ll and found this:

drwxr-xr--  3 root       root       4096 mar  5 18:49 .mysql/

I tried to change permissions using sudo chmod 757 .mysql, but when I execute the program again, I get the error I/O error: Permission denied

This does not happen when I run mysql-workbench with sudo.. but I don't want to be executing a terminal for each program that needs to do the same process for permissions and I need the console for logging my errors on the applications I code.

Best Answer

This problem happens because .mysql was created by root user using sudo and the permissions are to only read for others that are not the owner..

To simply fix this issue, change the owner of the folder to the desired user using this command in terminal:

sudo chown -R <user>:<group> .mysql

what this command does? i will explain each one of them

sudo stands for "switch user and do" which is actually changing the user to root internally for this operation

chown stands for "change owner" and it does what actually it means, of course for this command to work properly on a folder. the owner of the folder has to run it, in this case was root so sudo was necessary

-R this parameter is actually from chown and it applies the same command recursively to all sub folders/files

<user>:<group> this is just the desired owner and group we would like to assign to folder/file and its a mandatory parameter from chown. Also you have to enter the source of the folder/file next to this parameter

you can check more options for chown using man chown

Related Question