0

Right now I'm trying to set read access to the files of one of my databases. I'm using debian with basic mysql installation so the database location is /var/lib/mysql.

I want /var/lib/mysql/databaseName/** files to be readable for a few users so I'm trying to make a simbolic link to this directory but still can't use cd or ls. I tried chmod XX4 -R on this folder(/var/lib/mysql/databaseName) but It's not working.

root@serverName:/var/lib/mysql# ll
...
rwxr--r-- 2 mysql mysql      4096 Sep 16 11:04 databaseName
...

I would like to know if giving this readable permissions is an importante security issue. If it's not I would like to know how to solve this :)

Thanks for your time guys!

  • "I want /var/lib/mysql/databaseName/** files to be readable for a few users" - what do you want to do that for exactly? Users should interact with database files via the database server, not directly at the OS level. – Mat Sep 16 '14 at 11:48
  • Some scripts are being executed and their location is the database location. For clients requirements those files should remain there but they want readable access to them too. – Jesus Sep 16 '14 at 12:20
2

usual way to give read acces to a database is

 mysql -u root databaseName # connect to database in mysql
 grant connect to whoever ; # without password
 grant connect to whoever identified by clever ; # with a passwd
 grant connect to whoever@localhost ; # you must be logged whoever on localhost

see also

Even if you want your user to copy the database, copying sould be done through :

mysqldump database | mysql -u whoever targetdatabase

Access

To acces file from client script

  • /var/lib/mysql/databaseName sould be rwxrwxr-x,
  • /var/lib/mysql/databaseName:* sould be rwxrwxr-x.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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