| View previous topic :: View next topic |
| Author |
Message |
RSE
Joined: 18 Nov 2004 Posts: 5 Location: Leeds, UK
|
Posted: Thu Dec 30, 2004 3:34 pm Post subject: MySQL Databases |
|
|
Hi,
Can anyone tell me where the MySQL databases are stored on these servers. I want to back mine up through SSH but can't find them.
N.B. I can't use PHPMyAdmin because for some reason all of my sites have stopped working (great).
Thanks for your help. _________________ Adam Ross Williams
IT & Marketing Manager
SLBM.co.uk |
|
| Back to top |
|
 |
:LJ:
Joined: 21 Dec 2004 Posts: 426
|
Posted: Thu Dec 30, 2004 4:02 pm Post subject: |
|
|
You don't need to backup the data files - just run a command like this :
| Code: |
mysqldump --databases {database name} >dbdump.sql
|
That will give you a runnable SQL script in the file dbdump.sql, which includes the whole structure and all the data.
To import it back into the server, run :
| Code: |
mysql -u root -p <dbdump.sql
|
|
|
| Back to top |
|
 |
RSE
Joined: 18 Nov 2004 Posts: 5 Location: Leeds, UK
|
Posted: Thu Dec 30, 2004 4:07 pm Post subject: |
|
|
Excellent, that has worked perfectly... i might even go all out and write a php script to do that then email me the file home, next time im feeling lucky!!
Thanks Lee you're a star! _________________ Adam Ross Williams
IT & Marketing Manager
SLBM.co.uk |
|
| Back to top |
|
 |
:LJ:
Joined: 21 Dec 2004 Posts: 426
|
Posted: Thu Dec 30, 2004 4:57 pm Post subject: |
|
|
No problem, mate - I'm useful sometimes.
Incidentally, if you do ever want to copy the datafiles themselves, you have to stop the server first. It's actually possible to hot-swap datafiles between 4.1 and 4.0, too, but only if you don't have any InnoDB tables and no transactions are currently in progress.
Oh, one other thing - SQL dump files compress very well. It's usually worth doing that before you transfer them anywhere. |
|
| Back to top |
|
 |
:LJ:
Joined: 21 Dec 2004 Posts: 426
|
Posted: Sun Feb 06, 2005 2:23 am Post subject: |
|
|
| Suggest move to guides (possibly - it might be an idea to replace with a decent n00b guide to setting up MySQL 4.1 rather than 3.23 which comes as an option). |
|
| Back to top |
|
 |
Admin Servelocity Staff
Joined: 01 Jan 1970 Posts: 124
|
Posted: Sun Feb 06, 2005 2:31 am Post subject: |
|
|
Let's put it there for now  |
|
| Back to top |
|
 |
andyccn
Joined: 04 Jan 2005 Posts: 380 Location: Midlands, UK
|
Posted: Mon Feb 07, 2005 7:46 pm Post subject: |
|
|
| RSE wrote: | Excellent, that has worked perfectly... i might even go all out and write a php script to do that then email me the file home, next time im feeling lucky!!
Thanks Lee you're a star! |
I've already done this, use it as a cron job every night! (It saves the file in a place on my server which I can download via FTP.)
Give me your e-mail (PM) if you want and I'll email you it. |
|
| Back to top |
|
 |
Gufvug
Joined: 14 Aug 2006 Posts: 1 Location: USA
|
|
| Back to top |
|
 |
|