# How do you back up a mySQL database?

**URL:** https://boards.straightdope.com/t/how-do-you-back-up-a-mysql-database/98854
**Category:** Factual Questions
**Created:** [March 18, 2002, 9:07am UTC](https://boards.straightdope.com/t/how-do-you-back-up-a-mysql-database/98854 "2002-03-18T09:07:57Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Gozu\_Tashoya](https://avatars.discourse-cdn.com/v4/letter/g/7993a0/32.png) [@Gozu\_Tashoya](https://boards.straightdope.com/u/Gozu_Tashoya)
#### Post date: [March 18, 2002, 9:07am UTC](https://boards.straightdope.com/t/how-do-you-back-up-a-mysql-database/98854/1 "2002-03-18T09:07:57Z")

</div>

The story is that my webhost has decided to upgrade both their servers _and_ their control panel without giving me much in the way of advance warning. Which had the _oh so fun_ side effect of wiping out my web site, short of what I had backed up (thankfully) a day or two before the change.

My SQL database and, by corollary, my phpBB message boards, OTOH, are unrecoverable, AFAICT. Judging from the email sent by tech support, quoted below, I have to telnet/SSH in and go command line. Unfortunately, I apparently suck at command line interface, or something went wrong, because I didn’t get the reaction (a backed up db) that I was expecting.

Any advice (or a layman’s translation)?

> [@](#):
>
> Telnet or SSH to [akira.vosn.net](http://akira.vosn.net)  
> Login with your Perth server username and password  
> use the following command:  
> mysqldump --opt -u username -p databasename \> /path/to/backup.sql (press  
> enter)  
> Exampel: mysqldump --opt -u six\_phpbb -p six\_phpbb \> /home/six/backup.sql  
> When you run this command it will ask you for the password to username.  
> Enter the password and it will backup your SQL.
> 
> NOTE: this next command has to be issued from the directory of where your  
> backup.sql file is.  
> Now type:  
> ftp [wombat.rsan.net](http://wombat.rsan.net) (press enter)  
> User the username and password provided in the setup letter (FTP  
> username/password)  
> Then type:  
> bi (press enter)  
> then:  
> put backup.sql (press enter)  
> Once its finished transfering you can type:  
> quit (press enter)  
> exit (press enter)  
> and your DB will be on the new server.  
> It will still need to be imported to the DB on the new server, but at least the DB will be there and will not eb lost until I can import it.

---

<div class="post-metadata">

### Author: ![OneChance](https://avatars.discourse-cdn.com/v4/letter/o/74df32/32.png) [@OneChance](https://boards.straightdope.com/u/OneChance)
#### Post date: [March 18, 2002, 12:13pm UTC](https://boards.straightdope.com/t/how-do-you-back-up-a-mysql-database/98854/2 "2002-03-18T12:13:44Z")

</div>

You’re with VO, right? Anyway, what error messages are you getting? You’re not typing --opt with the mysqldump command, are you? Also, you’re not supposed to have spaces after the -u and -p. Here’s exactly what you want to type (well, of course you want to replace “username” and “password” with the actual username and password):

```auto

mysqldump -uusername -ppassword > ~/backup.sql

```

It’s probably best to put this in your crontab and have it run once or twice a day. Ideally, you should write a little script to run this command then send you the file via e-mail or FTP.

---

<div class="post-metadata">

### Author: ![Gozu\_Tashoya](https://avatars.discourse-cdn.com/v4/letter/g/7993a0/32.png) [@Gozu\_Tashoya](https://boards.straightdope.com/u/Gozu_Tashoya)
#### Post date: [March 18, 2002, 10:46pm UTC](https://boards.straightdope.com/t/how-do-you-back-up-a-mysql-database/98854/3 "2002-03-18T22:46:17Z")

</div>

Okay, now I’m muy annoyed. With RSANetworks, whose association with VO (whomever they are) is unknown to me.

I guess it’s all a moot point now, since the rat bastards have apparently gotten around to shutting down the server they upgraded.

_sigh_ Well, it’s not like my boards had _that_ many posts (I have posted more _here_ than we had posts at SDoN), but still.

Crontabs, huh? I guess I should get around to figuring out what they are and how to run them and stuff…

---

<div class="post-metadata">

### Author: ![OneChance](https://avatars.discourse-cdn.com/v4/letter/o/74df32/32.png) [@OneChance](https://boards.straightdope.com/u/OneChance)
#### Post date: [March 19, 2002, 8:26am UTC](https://boards.straightdope.com/t/how-do-you-back-up-a-mysql-database/98854/4 "2002-03-19T08:26:25Z")

</div>

[vosn.net](http://vosn.net) belongs to Ventures Online. So it appears that RSA Networks may be a reseller of [Ventures Online](http://www.venturesonline.com/) (VO). I’d ask RSA flat-out if they are resellers of VO. If they are, and you have an issue with them, then you should probably take it up with VO.

---

<div class="post-metadata">

### Author: ![Gozu\_Tashoya](https://avatars.discourse-cdn.com/v4/letter/g/7993a0/32.png) [@Gozu\_Tashoya](https://boards.straightdope.com/u/Gozu_Tashoya)
#### Post date: [March 20, 2002, 4:04am UTC](https://boards.straightdope.com/t/how-do-you-back-up-a-mysql-database/98854/5 "2002-03-20T04:04:41Z")

</div>

Okay, I guess the server was down temporarily, as I managed to log in and backup the db.

Thing is now, though, that FTP has apparently been disabled as I get a permission denied message. Any ideas on how to get that bad boy out of there now?

---

<div class="post-metadata">

### Author: ![ModernRonin2](https://avatars.discourse-cdn.com/v4/letter/m/c37758/32.png) [@ModernRonin2](https://boards.straightdope.com/u/ModernRonin2)
#### Post date: [March 20, 2002, 4:53am UTC](https://boards.straightdope.com/t/how-do-you-back-up-a-mysql-database/98854/6 "2002-03-20T04:53:03Z")

</div>

I dunno what program you’re using to SSH in,  
but if you’re coming from a Unix system of some sort, there’s probably a program called “scp” lying around. This is a remote file copy program based on SSH. If ssh works, it will too. If you’re coming from WinDoh’s! your SSH program might have some kind of file transfer through SSH option; check it out.  
-Ben

---

<div class="post-metadata">

### Author: ![Gozu\_Tashoya](https://avatars.discourse-cdn.com/v4/letter/g/7993a0/32.png) [@Gozu\_Tashoya](https://boards.straightdope.com/u/Gozu_Tashoya)
#### Post date: [March 20, 2002, 10:45am UTC](https://boards.straightdope.com/t/how-do-you-back-up-a-mysql-database/98854/7 "2002-03-20T10:45:20Z")

</div>

**ModernRonin** , you are a god! (Not THE god, A god.)

You’ve also proven, btw, that I’m retarded when it comes to command line interface. I found myself a new SSH program, and it just so happens to have a nice Windows-looking file transfer thing built in. I dragged, and dropped, an _voila_ backup.sql is sitting on my desktop.

Of course, now I have to see if I actually backed it up correctly…
