Reputation: 21
First of all I go to mysql workbench directory using the command prompt(cmd.exe), then I have the fallowing command that works correctly:
mysqldump --host=ip1 --user=username --password=123 --dadabase=dbName --tables tb1 --quick --force --routines --events --lock-tables=false ==compress | mysql --host=ip2 --user=username --password=123 -b dbName
My problem is when I try to execute this command in application the code is:
Process.Start("C:\program files\Mysql\Mysql Workbench 6.3 CE\mysqldump.exe","--host=ip1 --user=username --password=123 --dadabase=dbName --tables tb1 --quick --force --routines --events --lock-tables=false ==compress | mysql --host=ip2 --user=username --password=123 -b dbName")
When I execute this code, nothing happens... I also try to use shell
dim id as integer = Shell("C:\program files\Mysql\Mysql Workbench 6.3 CE\mysqldump.exe --host=ip1 --user=username --password=123 --dadabase=dbName --tables tb1 --quick --force --routines --events --lock-tables=false ==compress | mysql --host=ip2 --user=username --password=123 -b dbName")
certainly I'm usin the parameters in wrong way :( ... Can someone help me?
I also used federated table but in this situation because of big size of the table, the ram of the servers was overcharged....
Upvotes: 0
Views: 1998
Reputation: 634
Shell("C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin\\mysqldump.exe --user=root --password=admin --host=localhost --databases myDB > C:/db_backup.sql")
Upvotes: 0
Reputation: 21
After some research I found a solution, that is:
Process.Start("cmd.exe","/k cd C:\Program Files MySQL Server 5.7\bin\ & mysqldump --host=ip1 --user=username --password=123 --dadabase=dbName --tables tb1 --quick --force --routines --events --lock-tables=false ==compress | mysql --host=ip2 --user=username --password=123 -b dbName & exit")
before I was trying to execute mysqldump directly, but i realized that I had to execute the command prompt(cmd.exe) first and execute mysqldump in it own dir using the parameters that i need. (when we use /k in the begining of the arguments we can use multiple commands and the char '&' separates different commands such as change directory or execute the mysqldump.exe).
Upvotes: 1