The structure is the following
ravas@ravas-desk-lmde /var/lib $ pwd
/var/lib
ravas@ravas-desk-lmde /var/lib $ ls -l | grep mysql
drwx------ 13 mysql mysql 4096 Feb 10 22:32 mysql
When I try to get into /var/lib/mysql, I don't have rights
ravas@ravas-desk-lmde /var/lib $ cd mysql/
bash: cd: mysql/: Permission denied
though I belong to the mysql group
ravas@ravas-desk-lmde /var/lib $ groups ravas
ravas : ravas adm dialout cdrom floppy sudo audio dip video plugdev lpadmin sambashare mysql
What's the problem here?
The default location for the Unix domain socket is /var/lib/mysql/mysql.
Usually /var/lib/mysql or /var/db/mysql directory used to store database and tales under UNIX like operating systems. You can use the following command to locate MySQL datadir: grep datadir /etc/my.cnf. datadir=/var/lib/mysql. Or.
sudo -i
then
cd /var/lib/mysql/
mysql user is the only one that can access to the directory, you can use root to access there and change permissions, or you can change the directory permissions to 740 with
chmod 740 /var/lib/mysql
permissions are divided in 3 parts user/group/else. and you have
drwx------
d= directory
r= read = 4
w=write = 2
x=execute = 1
so the "owner" has read(4) + write(2) + execute(1) = 7 permissions in that directory
every one else doesn't
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With