Welcome to WebmasterWorld Guest from 54.198.46.95

Forum Moderators: open

Message Too Old, No Replies

CronJob and MySql updates

     
9:48 am on Dec 2, 2009 (gmt 0)

5+ Year Member



Hi, I run a forum and need to run some updates to the mysql database every 24 hours via a cron job.

Here is my SQL Update query

update members set ID_GROUP="12" where ID_group="0"

so i want to put this in a file called update-group.sql

but not sure on the formate of the sql file.

i would like the sql file to contain the login info for the database aswell

can anyone help?

12:22 pm on Dec 7, 2009 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld [webmasterworld.com], ulk26!

you can't put the login information in the sql file.
it is provided in the command line:

mysql -uusername -ppassword databasename <update-group.sql

12:27 pm on Dec 7, 2009 (gmt 0)

5+ Year Member



Thanks for the reply, what format do i need to put in the sql file

or is it a case of just putting in my update query?

3:08 pm on Dec 7, 2009 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



yes you simply put the sql statements in the .sql file and use stdin or pipe it into your mwsql command.
3:25 pm on Dec 7, 2009 (gmt 0)

5+ Year Member



ok thanks
 

Featured Threads

Hot Threads This Week

Hot Threads This Month