Click here to Skip to main content
16,020,080 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day!

I would like to ask what's wrong with my code in backing up my mysql database. Here's my code:

VB
Process.Start("C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqldump.exe", "-u username -p password db -r """ & txtpath.Text & "\backup.sql"" ")


whenever I use it, I get a 0 MB backup file. Furthermore, the command prompt shows asking for a password. When I entered my password in the database, it stated that there has been an error.

Any help will be appreciated! Thank you and God bless!
Posted
Comments
Richard MacCutchan 15-Sep-13 9:08am    
Please provide full details of the error you receive, we cannot guess it.
CHill60 15-Sep-13 11:08am    
There shouldn't be a space between -p and the actual password

1 solution

Because you have left a space after the -p you are essentially saying that the database does not have a password ... but it does - which is why the prompt then appears.

It then tries to backup a database called password (or whatever your password is) instead of your actual db - hence a 0 byte file
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 15-Sep-13 12:17pm    
Good catch, a 5.
—SA
CHill60 15-Sep-13 12:40pm    
Thank you :-)
Member 10187970 15-Sep-13 19:24pm    
Thank you @CHill60..:)
Member 10187970 15-Sep-13 19:35pm    
Hi! I tried your solution, but the error prompted that mysql cannot connect.
CHill60 16-Sep-13 12:08pm    
you'll need to confirm that you've got the logon id, password and database name correct ... given that you were prompted for the password when you had the space in I would hazard a guess that you've miskeyed the password ... it's probably case-sensitive as well

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