Page 1 of 1

Backuping SQL

PostPosted: 16. March 2005 21:15
by Killerfrog
Hello,

May someone explain me how backuping a full mysql database step by step and how to use backup if anything fails please?

I've tried with phpmyadmin, but found that when I export my entire database, i'm just unable to re-upload it! (In fact, I have to export each database than recreate each one and replug data which seems to be a little bit anoying... i'm sure there is a faster and better way to do backup of mysql.

Thx

PostPosted: 16. March 2005 21:36
by joannew
to reload the data from the command line

mysql> source filepath.txt

PostPosted: 17. March 2005 00:11
by taustin
There is a command line program in the mysql\bin\ directory called mysqldump.exe that will do the backup.

mysqldump -A --user root --password=password >backup.sql

will dump the entire server in to a file called "backup.sql" in the current directory. (-A means "dump all databases, --user defines the user, root should work, but any user with adequate priviliges will do, too, --password= sets the password, and whatever you put after the ">" is the file name it will dump to.)

You can resort by starting up the mysql from the command line, by typing in "mysql --user root" (or whatever user you're using). It should prompt you for a password if one is needed. Once you're in, you can run the backup.sql file (or whatever you called it) by typing in "source backup.sql" (or "source path\to\backup\file\backup.sql", if it's not in the bin directory).

If there's much there, it will take a *long* time to restore.

PostPosted: 17. March 2005 02:38
by Killerfrog
Thx

Do I have to be local to the computer to do that?

Is there no programe that can do that even more easier?

PostPosted: 17. March 2005 07:28
by dobbelina
If you have a large database phpmyadmin usually like to "time out"
when restoring large databases.
If you gonna restore the whole database (and it's not to large) you
have to click the "sql query window" up in the left corner.
After that (in the pop-up window) click import files.
That's the only way to import databases that has the
"CREATE DATABASE" statement.
It would be a better idea though to backup each database separately.
You do that by clicking the database name in the left drop down, then
choose export. (Be sure to select all tables).
Restoring of large databases are best done with bigdump.
Bigdump is a restore script that uses javascript to restore the database
3000 lines at a time. (doesn't time out).
You simply upload your database (uncompressed) and run the script
on the server.

Bigdump can be found here:
http://www.ozerov.de/bigdump.php

PostPosted: 17. March 2005 15:12
by Killerfrog
Thx,

I prefer this method.

I just tried and it worked perfecly to backup then rewrite database!

PostPosted: 17. March 2005 17:53
by taustin
Killerfrog wrote:Thx

Do I have to be local to the computer to do that?

Is there no programe that can do that even more easier?


To use the command line tool, yes, I believe you have to be local. So long as the file isn't too big, the phpmyadmin stuff is easier to use.

PostPosted: 17. March 2005 19:58
by Killerfrog
k thx