LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-04-2011, 02:52 PM   #1
fro1269
LQ Newbie
 
Registered: Oct 2010
Distribution: Centos 5.5, Ubuntu 10.04 , Fedora 14
Posts: 6

Rep: Reputation: 0
Talking 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!
 
Old 01-04-2011, 03:11 PM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
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.
 
1 members found this post helpful.
Old 01-04-2011, 03:17 PM   #3
fro1269
LQ Newbie
 
Registered: Oct 2010
Distribution: Centos 5.5, Ubuntu 10.04 , Fedora 14
Posts: 6

Original Poster
Rep: Reputation: 0
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!
 
Old 01-04-2011, 03:27 PM   #4
fro1269
LQ Newbie
 
Registered: Oct 2010
Distribution: Centos 5.5, Ubuntu 10.04 , Fedora 14
Posts: 6

Original Poster
Rep: Reputation: 0
Is there a benefit to doing BOTH a mysqldump and a backup of /var/lib/mysql ?
 
Old 01-04-2011, 03:41 PM   #5
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
Originally Posted by fro1269 View Post
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.
 
Old 01-04-2011, 06:09 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 02:13 PM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Software 3 06-28-2007 11:46 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 03:35 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration