Backup mySQL databases from localhost running on Wamp server


For a while now I've been trying to automate the backup of some databases I've got running in my localhost. I have a couple of personal apps running on my PC and I would like to back their db's continuously so as not to lose any of that info (because it's not online, so there's always the issue with my PC breaking down or a virus wiping everything out, etc.)

So I've been looking for a way to do this for some time now. I've continuously hit walls due to the fact that this is a local virtual server. But finally I seem to have found a way to do it.

It works perfectly at the output end. I mean, I wanted something that would output the dbs to my Dropbox, for instance, and this works... It outputs a file, alright, but the file is empty, which can only mean it's not able to retrieve the actual data. I've tried several things, including setting the exact path of the SQL data within my Wamp folder, but to no avail.

I'm rather stuck here. Maybe somebody could give me a hand. Thanks!

The PHP I'm using is simple enough, just an ´exec()´ command as you can see below:

exec('mysqldump --user='.$_SESSION['user'].' --password='.$_SESSION['password'].' --host=localhost myDatabase > C:\Users\Xavier\Dropbox\db_backups\file.sql');


OK! So it seems I was able to get it to work.

A little more research and I found this website: <a href="http://snippetsofcode.wordpress.com/2011/08/02/howto-dump-mysql-database-on-wamp/#respond" rel="nofollow">See the website</a>

Basically, it told me what path to follow in order to run the mysqldump on the Dbs in my Wamp server and everything was output as expected.

My case is rather specific and perhaps many people don't share this need, but this is the result:

exec('C:\wamp\bin\mysql\mysql5.6.12\bin\mysqldump --user='.$_SESSION['user'].' --password='.$_SESSION['password'].' --host=localhost myDatabase > C:\Users\Xavier\Dropbox\db_backups\file.sql');

By the way, thanks a lot to @MarcB and @mb14 for trying to help me out and posting their comments below!


  • Runs as a macro on visual basic for windows application - Access Database
  • MS Access setting to ignore date conversion error
  • Why are script properties lost when passing pscustomobject to start-job script block?
  • .net detect distributed transaction
  • How to get the revision of an item with Dropbox API
  • cannot run python script file using windows prompt
  • Is it one-to-one or Component ? Nhibernate Mapping
  • input type=“file” accept=“image/*” doesn't work in phone gap?
  • Installing PAR::Packer on Windows, dmake error 255
  • UIBarButtonItem's action is not called when in a view with a UIGestureRecognizer
  • C++/CLI Thread synchronization including managed and unmanaged code
  • Specifying virtual keyboard type for EditText in XML
  • Generic/Unknown HTTP Error with response code 0 using UnityWebRequest
  • How can I get the choice “H2” back in the H2 consol?
  • using System.Speech.Synthesis with Windows10 universal app (XAML-C#)
  • Query to find the duplicates between the name and number in table
  • ADO and msqli connections very slow
  • Alternative to overridePendingTransition() - Android
  • Eloquent update method change created_at timestamp
  • PHP buffered output depending on server setting?
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • Highlight one bar in a series in highcharts?
  • javaw.exe and eclipse startup problems
  • Resize panoramic image to fixed size
  • How to recover from a Spring Social ExpiredAuthorizationException
  • Volusion's generic SQL folder, functionality
  • ILMerge & Keep Assembly Name
  • Deserializing XML into class C#
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • Large data - storage and query
  • Function pointer “assignment from incompatible pointer type” only when using vararg ellipsis
  • WOWZA + RTMP + HTML5 Playback?
  • Calling of Constructors in a Java
  • PHP: When would you need the self:: keyword?
  • How do you join a server to an Active Directory (domain)?
  • coudnt use logback because of log4j
  • python draw pie shapes with colour filled
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • costura.fody for a dll that references another dll
  • How to Embed XSL into XML