[PHP] OT - php/mysql/cron
Any way to use cron to automate the mysqldumping of databases on a nighly basis? Any examples would be greatly appreciated. TIA, Kelly
Re: [PHP] OT - php/mysql/cron
On Mon, 2002-06-03 at 13:18, Kelly Meeks wrote: Any way to use cron to automate the mysqldumping of databases on a nighly basis? Any examples would be greatly appreciated. This line's gonna wrap, but it all goes on the same line :P 0 0 * * * /usr/local/bin/mysqldump -u username --password=password database outputfile Obviously replace username, password, database, and outputfile with the values you want to use for each. Of course, I would never recommend putting a secure password in a text file like your crontab, so if you have admin rights on the server maybe consider setting up a read-only account with no password, or maybe a unique password that won't work on any other accounts. Never hurts to be a little paranoid. HTH, Toby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OT - php/mysql/cron
Here's a little tweak to gzip the backup results. I put this into another script that gets called by crontab. Are my DB userid and password still visible when run this way? I'm never here to see it run, because it happens late at night. /usr/bin/mysqldump --user=DBUSER --password=DBPASSWORD DATABASETOBACKUP | gzip /backup_path/backup.sql.gz -Original Message- From: Tobyn Baugher [mailto:[EMAIL PROTECTED]] Sent: Monday, June 03, 2002 1:29 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] OT - php/mysql/cron On Mon, 2002-06-03 at 13:18, Kelly Meeks wrote: Any way to use cron to automate the mysqldumping of databases on a nighly basis? Any examples would be greatly appreciated. This line's gonna wrap, but it all goes on the same line :P 0 0 * * * /usr/local/bin/mysqldump -u username --password=password database outputfile Obviously replace username, password, database, and outputfile with the values you want to use for each. Of course, I would never recommend putting a secure password in a text file like your crontab, so if you have admin rights on the server maybe consider setting up a read-only account with no password, or maybe a unique password that won't work on any other accounts. Never hurts to be a little paranoid. HTH, Toby -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT - php/mysql/cron
Tobyn Baugher [EMAIL PROTECTED] wrote: This line's gonna wrap, but it all goes on the same line :P 0 0 * * * /usr/local/bin/mysqldump -u username --password=password database outputfile Obviously replace username, password, database, and outputfile with the values you want to use for each. Of course, I would never recommend putting a secure password in a text file like your crontab, so if you have admin rights on the server maybe consider setting up a read-only account with no password, or maybe a unique password that won't work on any other accounts. Or create a .my.cnf file in the home directory of the user the cron job runs as, chmod 600 .my.cnf and include the following in it: [client] user=mysql_user_here password=mysql_password_here Then you don't need to supply the -u and --password parameters to mysqldump. Only that user can read .my.cnf and you won't need to supply those parameters to the mysql commandline program or other MySQL programs if you want to login as that default user. -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php