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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
02-18-2004, 09:37 AM
|
#1
|
|
Member
Registered: Oct 2003
Location: Where No One's Been... Spiral Out!
Distribution: FreeBSD
Posts: 201
Rep:
|
MySQLDump and Cron
I cannot get mysqldump to work with cron. The following command works at command line, but not through cron:
mysqldump -uusername -ppassword --opt my_db | bzip2 > /tmp/my_db.sql.bz2
I have two problems with this.
1. It doesn't work. That's the biggest problem. I have even put in the full path to mysqldump, but that does not work, either.
2. I don't like passwords viewable in plain text format. So even if the dump above would work, ideas as to how to make it more secure would be appreciated.
Thanks!
|
|
|
|
02-18-2004, 11:11 PM
|
#2
|
|
Member
Registered: Oct 2003
Location: Where No One's Been... Spiral Out!
Distribution: FreeBSD
Posts: 201
Original Poster
Rep:
|
Anybody have any ideas?
|
|
|
|
02-19-2004, 07:31 AM
|
#3
|
|
LQ Veteran
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,756
|
1) I'm not sure why the cron job isn't working. Are you sure cron is running? Is there anything in the logs that might shed some light?
2)Why don't your create a new mysql user specifically for this task. You could create one that doesn't have a password and then give it EXTREMELY limited privileges. Or keep the password for that user, but still severely restrict privileges. You're shooting to have ONLY those privileges needed to run mysqldump. That way if someone does get their hands on that username (and password if you choose), they wouldn't be able to do anything.
|
|
|
|
02-19-2004, 08:01 AM
|
#4
|
|
Senior Member
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032
Rep:
|
I wrote a simple script for backing up a mysql database every day through cron and it works well, I still use it (although a little altered). You can find it in this post. I hope that helps a bit.
Håkan
|
|
|
|
02-19-2004, 02:56 PM
|
#5
|
|
Member
Registered: Oct 2003
Location: Where No One's Been... Spiral Out!
Distribution: FreeBSD
Posts: 201
Original Poster
Rep:
|
hw-tph, I will try something like that.
Hangdog42, I thought of the special user idea, but is there a way of giving a user mysqldump access, and nothing else??
I am sure cron is working, as I run cron functions an average of every 3-5 minutes for one task or another. It's simply the database backups that are being a pain.
|
|
|
|
02-19-2004, 03:47 PM
|
#6
|
|
LQ Veteran
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,756
|
I don't think there is a way to give access to just mysqldump since it is a program that uses database functions, it isn't a database function itself. From what I can tell (and believe me I'm no expert), you probably need SELECT and FILE and maybe SHOW DATABASES and LOCK TABLES. You might try with just a minimal set like these (or heck, even see if it works with just USAGE) and add privileges until it works.
Oddly, if you do a little searching on mysqldump, it looks as if most people run it from their admin account. That suggests either they aren't using a cron job to do their backup or they haven't thought through the security implications.
<edit>
You might also limit these privileges to username@localhost. If you restrict the mysqldump user to localhost then if someone DOES learn the username, they would also have to have an account on the specific box to make use of it.
</edit>
Last edited by Hangdog42; 02-19-2004 at 03:59 PM.
|
|
|
|
02-20-2004, 08:18 AM
|
#7
|
|
Member
Registered: Oct 2003
Location: Where No One's Been... Spiral Out!
Distribution: FreeBSD
Posts: 201
Original Poster
Rep:
|
I'll check out the privileges stuff. Also, I already have my box locked down as far as hosts are concerned (localhost only), so I'm not too worried about that. I'll probably do exactly that, though - just keep adding on one logical privilege at a time until it works.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:48 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|