Page 1 of 1

Need help for connect database at different

Posted: Fri Mar 18, 2005 3:54 pm
by windforceus
Hi ALL

I have a php website connected to mysql database in win2000 and I plan to backup my database at 12pm every night. Users will be directed to the other database. My problem is what happen if someone log in to my website at that time? I don't know if there is such thing to disconnect user in php or reconnect a different database at certain time. If any knows...i appreciate.

ray

any help is appreciated

Posted: Fri Mar 18, 2005 3:59 pm
by windforceus
I notice someone mention "crons" and "crons" seems can start a php script at certain time. Then, how about the users who are logging in already or have brower open?

...

Posted: Fri Mar 18, 2005 6:54 pm
by Calimero
Can't you just do it in PHP - include() it:

take the time and if between START of backup and END of BACKUP time - you think you will need: just give other parameters for DB connection and login.

hmm...thanks for reply

Posted: Fri Mar 18, 2005 6:58 pm
by windforceus
yes, i know i can include()..but that mean the website have to keep checking the time, right? So putting a time function in db.php and checking which db i will use will make the website be able to keep checking the time difference?

my concerns is...

Posted: Fri Mar 18, 2005 7:00 pm
by windforceus
The include function work when the page is loaded, so what happen if people load the page at 12:01 and i start to back up the database at 12:00? I need to have precise way to do this...

Posted: Fri Mar 18, 2005 7:07 pm
by timvw
why do you want to use another database server anyway? while the mysqldump is executing, concurrent changes to your data won't be included (they will be in the backup of tomorrow). even if you directd to a *different* server, the one you are using as a source for the backup doesn't know about those changes... in this case you're ready for real pita situations..



------------------------------------------------------------------------------------
on a big site, i always see the following structure:

(these are the replications that are used for read/select)
[repl1] [repl-2] ..... [repl-n]

(this is the one used for write/insert/update)
[master]

thanks for reply

Posted: Fri Mar 18, 2005 7:14 pm
by windforceus
Sorry, i am a newbie...that is why i may ask dump question. What is mydqldump doing in the database? i saw it in mysql but i dont' know what it is for..So concurrent change wont' be include? Say if those concurrent change is in the backup of tomorrow, i need to add the backup to my current database tomorrow? I have no exp on those process, that is why i ask those questions, hope you don't mind...

Posted: Sat Mar 19, 2005 6:33 am
by timvw
time to read the manual then, it's all explained in there... (comes down to run mysqldump every 24hours and you're set)

Posted: Sat Mar 19, 2005 11:53 am
by phpScott
mysql_dump just dumps all the data and other parameters you can set into a file and you can use that file to back up your db or what ever you want to do with it.

All that will happen is that any changes that occur while you are 'dumping' the database will be inserted into your back up the following day. Nothing to worry about as that is standard when doing back up's.

It is like changing your php script and then coping it some where else then going back to the original to make any changes, those changes won't be in your back up script until you copy over it agian.

phpscott