Question

I'm using Wamp to, among other things, run a couple of local PHP sites that use local mySQL dbs in order to organize and keep personal info. None of this touches anything outside my PC. It just works on my local virtual server. However, if something happens to my PC, then everything's gone. If this were online, in an external server, then there's auto backup, but as it is private info, security issues make this impossible, besides impractical.

What I would like is to be able to export my SQL db upon hitting the SAVE button on new info I'm inserting into the db. I would like to save the db into, for example, my Dropbox folder. This way, if anything happens to my PC, I have my dbs secure in my Dropbox.

I've found how to backup dbs onto the same server and obviously I know how to do it manually through phpMyAdmin, but I can't find how to this onto a computer, moreover, the same computer where the local server is being run with the dbs.

Can anyone please help?

Was it helpful?

Solution 2

In the end, after much looking into the issue and leaving it, letting it ripen in my mind, I was able to find exactly what I needed by using mysqldump:

exec('mysqldump --user=XXX --password=XXX --host=localhost DBNAME > outputfile.sql');

Hope it might help someone else out there!

P.S. Thanks a lot to @hellosheikh for the answer. It did provide very interesting info that might prove handy later on. However, for my exact needs, this second way in the end proved more practical.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top