How to take database back up in Mysql

Post Reply
sajith
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India
Contact:

How to take database back up in Mysql

Post by sajith »

hi,can some one help me

How to take database back up in Mysql and also to restore it back.

regards,
sajith
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: How to take database back up in Mysql

Post by anserkk »

How to take database back up in Mysql and also to restore it back.
Use MySQL Administrator, there you have Backup and Restore.

Till now I have not tried to take MySQL backup using FWH application. I believe that somebody here may be able to help you in this regard

Regards
Anser
sajith
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India
Contact:

Re: How to take database back up in Mysql

Post by sajith »

Dear Anser,Many Many thanks for ur Help

Regards,
sajith
User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Re: How to take database back up in Mysql

Post by Armando »

sajith:

You can do a backup/restore using your own code.

Please take a look to MySql manual

http://dev.mysql.com/doc/refman/5.0/es/backup.html

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: How to take database back up in Mysql

Post by anserkk »

Dear Mr.Armando,

I understand that there are some difficulties for taking MySQL backup from an application using the command line tool "mysqldump.exe" either from FWH, VB or any application

Reason:

The reason is that the mysqldump.exe is available only on the MySQL Server installation directory. (C:\Program Files\MySQL\bin\ on my MySQL server).

You can take backup with the mysqldump.exe if our apllication is running on the the same PC/Server running MySQL database Server.

Suppose if you need to take MySQL database back using FWH app installed on many PC's on the network and you need to take MySQL backup from any client PC on the network, then you need to have a copy of mysqldump.exe on each and every PC

I assume, FWH WaitRun() can be used

Command
mysqldump --host=host_ip --port=port_num -u UserName --password=password --all-databases --opt -c > c:\Backup\BACKUP_FILE.SQL

I have not tested it personally

Do you have any sample for Restore ?

Regards
Anser
User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Re: How to take database back up in Mysql

Post by Armando »

Mr. Anserkk
anserkk wrote: I understand that there are some difficulties for taking MySQL backup from an application using the command line tool "mysqldump.exe" either from FWH, VB or any application
Yes you are right, it's not easy.
anserkk wrote: Do you have any sample for Restore ?
Unfortunately not, sorry :(

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Willi Quintana
Posts: 859
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú
Contact:

Re: How to take database back up in Mysql

Post by Willi Quintana »

Hello,,,
I use this command for backup....
SELECT * INTO OUTFILE 'e:\BACKUPS\productos.txt' FROM productos

for restore....
LOAD DATA INFILE 'e:\BACKUPS\productos.txt' INTO TABLE productos

Regards
Willi

PD (my English is bad,,, sorry)
User avatar
Willi Quintana
Posts: 859
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú
Contact:

Re: How to take database back up in Mysql

Post by Willi Quintana »

Hi,,,
SELECT * INTO OUTFILE 'e:\BACKUPS\productos.txt' FROM productos
and
LOAD DATA INFILE 'e:\BACKUPS\productos.txt' INTO TABLE productos
is available only on the PC with MySQL Server

Regards
Willi
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: How to take database back up in Mysql

Post by anserkk »

Dear Mr.Willi,

Thanks.
SELECT * INTO OUTFILE 'e:\BACKUPS\productos.txt' FROM productos
and
LOAD DATA INFILE 'e:\BACKUPS\productos.txt' INTO TABLE productos
The problem that I understand with the above command is that it will generate only the backup of the data in text format and not the structure of the tables. Whereas the output created from mysqldump.exe generates a script containing the SQL for the tables structures creation with Insert SQL statements to insert data's to the table, which is highly portable.

Regards
Anser
User avatar
Willi Quintana
Posts: 859
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú
Contact:

Re: How to take database back up in Mysql

Post by Willi Quintana »

Dear Mr. Anser
You want to make a backup of data or want to export data?
for backup, you must first create the database from your application and may make the restore from the txt file
personally successfully use this sentence to all tables in the database .

Regards
Willi
Post Reply