How to take database back up in Mysql

How to take database back up in Mysql

Postby sajith » Wed Oct 14, 2009 7:53 am

hi,can some one help me

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

regards,
sajith
sajith
 
Posts: 110
Joined: Wed Feb 18, 2009 9:58 am
Location: India

Re: How to take database back up in Mysql

Postby anserkk » Wed Oct 14, 2009 9:55 am

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
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: How to take database back up in Mysql

Postby sajith » Wed Oct 14, 2009 10:36 am

Dear Anser,Many Many thanks for ur Help

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

Re: How to take database back up in Mysql

Postby Armando » Wed Oct 14, 2009 2:59 pm

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
Armando
 
Posts: 3217
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: How to take database back up in Mysql

Postby anserkk » Thu Oct 15, 2009 6:06 am

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
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: How to take database back up in Mysql

Postby Armando » Thu Oct 15, 2009 1:16 pm

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
Armando
 
Posts: 3217
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: How to take database back up in Mysql

Postby Willi Quintana » Fri Oct 16, 2009 3:14 am

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: 1019
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú

Re: How to take database back up in Mysql

Postby Willi Quintana » Fri Oct 16, 2009 3:18 am

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
Willi Quintana
 
Posts: 1019
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú

Re: How to take database back up in Mysql

Postby anserkk » Fri Oct 16, 2009 6:10 am

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
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: How to take database back up in Mysql

Postby Willi Quintana » Fri Oct 16, 2009 9:54 pm

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
User avatar
Willi Quintana
 
Posts: 1019
Joined: Sun Oct 09, 2005 10:41 pm
Location: Cusco - Perú


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 54 guests