LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   why cannot cd mysql datadir? (https://www.linuxquestions.org/questions/linux-newbie-8/why-cannot-cd-mysql-datadir-895416/)

mei0fei 08-03-2011 09:16 PM

why cannot cd mysql datadir?
 
here is mysql datadir:
mei@ubuntu:~$ ls -ld /var/lib/mysql
drwx------ 5 mysql mysql 4096 2011-08-04 09:35 /var/lib/mysql

mei@ubuntu:~$ cd /var/lib/mysql
bash: cd: /var/lib/mysql: Permission denied

mei@ubuntu:~$ sudo cd /var/lib/mysql
sudo: cd: command not found

mei@ubuntu:~$ sudo cp -rf /var/lib/mysql /mysql1
mei@ubuntu:~$ cd /mysql1

mei@ubuntu:/mysql1$ ls -la
total 12
drwxr-xr-x 3 mysql mysql 4096 2011-08-04 10:04 .
drwxr-xr-x 24 root root 4096 2011-08-04 09:20 ..
drwx------ 5 root root 4096 2011-08-04 10:04 mysql

mei@ubuntu:/mysql1$ cd mysql
bash: cd: mysql: Permission denied

I need help! thanks

Diantre 08-03-2011 11:10 PM

Quote:

Originally Posted by mei0fei (Post 4433143)
Code:

mei@ubuntu:/mysql1$ ls -la
total 12
drwxr-xr-x  3 mysql mysql 4096 2011-08-04 10:04 .
drwxr-xr-x 24 root  root  4096 2011-08-04 09:20 ..
drwx------  5 root  root  4096 2011-08-04 10:04 mysql

mei@ubuntu:/mysql1$ cd mysql
bash: cd: mysql: Permission denied


The directory has read, write and execute permissions for the superuser only. Either log in as root with su -, or change the permissions on the directory:

Code:

su -c 'chmod 755 <directory>'


All times are GMT -5. The time now is 01:32 PM.