Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just installed mysql on latest Ubuntu and i want to access /var/lib/mysql directory It seems there are permissions set for this user :mysql - MySQL Server but i do not have the password for it. What can I do to access that directory ?

share|improve this question
up vote 1 down vote accepted

If you check /etc/passwd, the shell is probably set to /bin/false. This account is usually not meant to be logged into, quite unlike Postgres. It exists to separate the privileges of the mysql database from those of other users on the system.

You don't know why you want to go in there, for normal mysql operations, this seldom needs to be done and there is probably a better way to do what you're wanting to do.

However, if you truly do need access to this directory, sudo to root and make your changes, making sure to chown anything to the mysql user when you are done.

share|improve this answer
It should be a very rare event when you need to access the files directly; the only times this should be done is if you need to check the file sizes or relocate files on a different filesystem while retaining the datadir. – symcbean Jun 13 '11 at 9:39

If you are going to be accessing the directory directly often, you could add the mysql group to your user. Most of the time you will not need to do much directly in the directory so it is usually easier to use sudo to modify what you need. Lastly, if you just want to view the items in the directory you could change the permissions on the directory everyone read permissions although I would not recommend changing them unless you really have to.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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