-1

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 ?

2 Answers 2

1

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.

1
  • 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, 2011 at 9:39
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .