从在Wamp服务器上运行的localhost备份mySQL数据库 [英] Backup mySQL databases from localhost running on Wamp server

查看:338
本文介绍了从在Wamp服务器上运行的localhost备份mySQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一段时间,我一直在试图自动备份一些数据库,我已经运行在我的本地主机。我有几个个人应用程序运行在我的电脑上,我想不断地回退他们的数据库,以免丢失任何信息(因为它不在线,所以总是有我的电脑崩溃或病毒擦除一切的问题out等)。

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.

它在输出端完美地工作。我的意思是,我想要的东西,将输出dbs到我的Dropbox,例如,这工作...它输出一个文件,好吧,但文件是空的,这只能意味着它不能检索实际的数据。我尝试了几个东西,包括在我的Wamp文件夹中设置SQL数据的确切路径,但没有效果。

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!

我使用的PHP很简单,只是一个'exec()'命​​令,如下所示:

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');


推荐答案

更多的研究,我发现这个网站:查看网站

A little more research and I found this website: See the website

基本上,它告诉我为了运行在我的Wamp服务器的Dbs上的 mysqldump ,一切都按预期输出的路径。

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');

顺便说一下,感谢@MarcB和@ mb14尝试帮助我,他们的意见如下!

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

这篇关于从在Wamp服务器上运行的localhost备份mySQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆