FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to take database back up in Mysql
Posts: 110
Joined: Wed Feb 18, 2009 09:58 AM
How to take database back up in Mysql
Posted: Wed Oct 14, 2009 07:53 AM

hi,can some one help me

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

regards,
sajith

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: How to take database back up in Mysql
Posted: Wed Oct 14, 2009 09: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
Posts: 110
Joined: Wed Feb 18, 2009 09:58 AM
Re: How to take database back up in Mysql
Posted: Wed Oct 14, 2009 10:36 AM

Dear Anser,Many Many thanks for ur Help

Regards,
sajith

Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: How to take database back up in Mysql
Posted: Wed Oct 14, 2009 02: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
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: How to take database back up in Mysql
Posted: Thu Oct 15, 2009 06: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
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: How to take database back up in Mysql
Posted: Thu Oct 15, 2009 01: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
Posts: 1054
Joined: Sun Oct 09, 2005 10:41 PM
Re: How to take database back up in Mysql
Posted: Fri Oct 16, 2009 03: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)

Posts: 1054
Joined: Sun Oct 09, 2005 10:41 PM
Re: How to take database back up in Mysql
Posted: Fri Oct 16, 2009 03: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

Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: How to take database back up in Mysql
Posted: Fri Oct 16, 2009 06: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
Posts: 1054
Joined: Sun Oct 09, 2005 10:41 PM
Re: How to take database back up in Mysql
Posted: Fri Oct 16, 2009 09: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

Continue the discussion