Hi all!

I'm trying to perform a mysql database from vb.net. I use this code:

 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.

F1 please.

First step is to see what the console output says; open up a command window and run it manually.

Thanks gusano. 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?

Hm. localhost is the same as 127.0.0.1 so I'd expect the same result. If it couldn't connect to your server (for example if it was off), you'd get a different error... Hmmmmmm.

I was able to get a similar command to run for my local MySQL over here...

Unknown MYSQL Server host '127.0.0.1'--databases

Notice that there is no space between the host name and --databases in the error as reported; are there appropriate spaces in your manual command line?

commented: thanks. please check my reply. +2

Thanks gusano, though sorry I couldn't get you so well. But, I tried to remove all unwanted spaces.
But now I get a different error message:

"Mysqldump: Got error:1044:Access denied for user ''@'localhost' to database ',' when selecting the database. (this is exactly how the error msg says, I didn't remove a thing in the '')

My code for now is:

 "C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe", "--user=root --password =mypassword" "--host =localhost --port=3301 --databases MySQL databasename -r ""C:\GreatestHR Backup\BackUpDataBase.sql"""

Please, I would appreciate more help on this.

Solved it.

Solved it.

Good news! For anyone who runs across this thread later (and my own curiosity), what was the final issue?

Hi Gusano!
The trick was to remove all the "" in the second part of the command, and end up with something like this:

"C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqldump.exe", --user=root --password =mypassword --host =localhost --port=3301 --databases MySQL databasename -r "C:\GreatestHR Backup\BackUpDataBase.sql"

I have no explanations for that.
Thanks for offering to help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.