LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   backing up /var/lib/mysql as non-root user (http://www.linuxquestions.org/questions/linux-newbie-8/backing-up-var-lib-mysql-as-non-root-user-854209/)

fro1269 01-04-2011 02:52 PM

backing up /var/lib/mysql as non-root user
 
Hello

I am using Ubuntu 10.04.1 LTS x64. I would like to backup my /var/lib/mysql directory as a non-root user.

I have been backing this up using cron as the root user, but another admin in my company insists that we create a separate user to perform this task for security reasons. I have created a user, created a group, added the user to the group, but still cannot access /var/lib/mysql/mysql directory as that user. I would like that user to have +rx access only. I appreciate any help or feedback. Thanks!

Hangdog42 01-04-2011 03:11 PM

Quote:

I have created a user, created a group, added the user to the group, but still cannot access /var/lib/mysql/mysql directory as that user.
I know this sounds basic, but does the group have ownership of /var/lib/mysql? Also, are you looking to back up the directory itself, or are you looking to back up the databases? If it is the latter, something like mysqldump might solve the problem.

fro1269 01-04-2011 03:17 PM

Yes the group did have ownership of the directory, I think I just resolved the issue. I did a chmod 750 on /var/lib/mysql/mysql and /var/lib/mysql/phpmyadmin and now my user can read the files but not delete them. Thanks for your help!

fro1269 01-04-2011 03:27 PM

Is there a benefit to doing BOTH a mysqldump and a backup of /var/lib/mysql ?

Hangdog42 01-04-2011 03:41 PM

Quote:

Originally Posted by fro1269 (Post 4213160)
Is there a benefit to doing BOTH a mysqldump and a backup of /var/lib/mysql ?


I would think so. Mysqldump simply generates a sql script capable of replicating the database, so in theory, it is a bit more flexible than just a backup of the files. Usually when I do database backups, I use mysqldump simply because the script can be used on any MySQL installation.

chrism01 01-04-2011 06:09 PM

Alos, mysqldump provides a consistent snapshot of the DB state. Simply copying the files (if the DB is NOT shutdown) will not provide a usable backup.


All times are GMT -5. The time now is 09:46 PM.