how to create backup from mysql database lazarus / 16-Databases ---------------------------------------------------------------------- delphi887 · 2013-04-29 08:19 hi  I'm programming with Lazarus 1.08 and Zeos 7.03 in windows and Linux (Ubuntu). my database is mysql. i want create a form in my project and get path from user and create a backup from mysql database in selected path in single file *.sql . What does this have to do with???? tanks ---------------------------------------------------------------------- ludob · 2013-04-30 03:58 The easiest and the most compatible is to launch mysqldump from your program. See http://wiki.freepascal.org/Executing_External_Programs ---------------------------------------------------------------------- delphi887 · 2013-05-01 06:12 thank you my problem is solved. ---------------------------------------------------------------------- delphi887 · 2013-06-07 15:30 hi again  i trying backup and restore database from MySQL with Executing External Programs (http://wiki.freepascal.org/Executing_External_Programs) methods. create backup in *.sql script file is complete and Successfully. my code for create backup : Code: [Select]procedure Tbackup_form.BitBtn2Click(Sender: TObject); var AProcess: TProcess; begin   AProcess := TProcess.Create(Application);   AProcess.CommandLine:='mysqldump  --skip-tz-utc=TRUE  --host='+DataModule1.main_connection.HostName+' --skip-dump-date=TRUE  --user=asagostar -pasagostar123456   --add-locks=TRUE --port=3306  --skip-comments=TRUE --skip-disable-keys=TRUE --default-character- set=utf8 --max_allowed_packet=10G   --databases -R "asagostar"  -r "'+Edit1.Text+'"';   AProcess.Options := AProcess.Options + [poWaitOnExit]+[poNoConsole];   Label4.Caption:='process is doing please wait';   GroupBox1.Refresh;   BitBtn2.Enabled:=False;   AProcess.Execute;   Application.ProcessMessages;   Label4.Caption:='ready for start';   AProcess.Free;   BitBtn2.Enabled:=True; end;   but my problem in restore backup : Code: [Select]procedure Tbackup_form.BitBtn4Click(Sender: TObject); var Aprocess:TProcess; begin   AProcess := TProcess.Create(Application);   AProcess.CommandLine:='mysql  --host='+DataModule1.main_connection.HostName+' --user=asagostar -pasagostar123456 --port=3306 --default-character-set=utf8  asagostar <  "'+Edit2.Text+'"';   Memo1.Lines.Add(AProcess.CommandLine);   AProcess.Options := AProcess.Options + [poWaitOnExit]{+[poNoConsole]};   Label5.Caption:='process is runing pleas wait';   GroupBox2.Refresh;   BitBtn4.Enabled:=False;   AProcess.Execute;   Application.ProcessMessages;   Label5.Caption:='ready to doing process';   AProcess.Free;   BitBtn4.Enabled:=True; end;  i trying Similar previous method for restoring but in Tprocess method  "<" not worked. in cmd command working successfully and restoring backup but in my program this command not worked. As there is a wiki page  :  " TProcess is not a terminal/shell! You cannot directly execute scripts or redirect output using operators like "|", ">", "<", "&" etc " i trying other method example SysUtils.ExecuteProcess but It did not worked. Can anyone advise me how I can solve my problem??? ---------------------------------------------------------------------- BigChimp · 2013-06-07 15:34 Yes, read that wiki page and use e.g. sh or cmd.exe in your call as described in the wiki page. ---------------------------------------------------------------------- delphi887 · 2013-06-08 04:23 Thanks for the tips  but  Is there another way or solution  to create and restore backup file? how i can generate a simple SQL file to get SQL code for  create tables and routines  and data Also???  and for restore  execute SQL in the Query to create them and insert data. Thank you