homepage Welcome to WebmasterWorld Guest from 54.167.75.155
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
CronJob and MySql updates
ulk26




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

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?

 

phranque




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

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

ulk26




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

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?

phranque




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

yes you simply put the sql statements in the .sql file and use stdin or pipe it into your mwsql command.

ulk26




msg:4038772
 3:25 pm on Dec 7, 2009 (gmt 0)

ok thanks

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved