Click here to Skip to main content
15,904,348 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hi all!

I'm trying to perform a mysql database from vb.net. I use this code:
VB
Process.Start("C:\Program Files (x86)\MySQL\MySQL Workbench CE 5.2.44\mysqldump.exe", "--user=root --password=mypassword " _
& "--host=127.0.0.1 --databases MySQL databasename -r ""C:\GreatestHR Backup\BackUpDataBase.sql""")

When this code runs, a command prompt window opens and goes away immediately that i can't even read what it says. When I go to the output folder specified in the code, there is really BackupDatabase.sql but with only 0Kb, while the actual database has data in it. What could be the problem?

I repeat, I use mysql database in Mysql Workbenc 5.2.
Posted
Updated 10-Apr-13 7:56am
v2
Comments
ZurdoDev 10-Apr-13 11:59am    
There is likely an error and you can't see it because the window is going away. Instead, do Start, Run, CMD to open a command window that will not close when the process is done. The paste in what you have in the Process.Start string and see what happens.
CPallini 10-Apr-13 14:09pm    
Good advice: you should post it as solution, in my opinion.
savedlema 11-Apr-13 6:54am    
Thanks ryanb
. I did what you said and I was able to see this error msg:

"mysqldump:Got error:2005: Unknown MYSQL Server host '127.0.0.1'--databases MySQL databasename -r ""C:\GreatestHR Backup\BackUpDataBase.sql"""

But, the mysql server is really there and working, I can fetch and send data to it with my application. This problem happens only with this backup thing.

I tried to use "localhost" instead of 127.0.0.1 but same problem. I also tried to remove 'password' and add a port number, same problem.

Any advice?
Eloise Taylor 18-May-13 19:57pm    
Have you checked the permission levels for that user?

In MySQL Workbench there is a checkbox to grant backup privileges (labelled BackupAdmin) under Administrative Roles.
savedlema 20-May-13 18:43pm    
Hi all!
Now I got the code to work perfectly in a windows command prompt, it does all the job. But the problem comes when I bring it to VB.NET, It says the system can not find the file specified.
This is my code in VB:

Process.Start ( "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe" --user=root --password=mypassword --host=localhost --port=3306 --database sakila > "C:\backup\sakilalbackup.sql""")

I will appreciate any help.

1 solution

There is likely an error and you can't see it because the window is going away. Instead, do Start, Run, CMD to open a command window that will not close when the process is done. The paste in what you have in the Process.Start string and see what happens.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900