9 Replies - 5688 Views - Last Post: 17 March 2012 - 11:54 PM
#1
How to backup and restore mysql database using vb.net
Posted 17 March 2012 - 12:17 AM
I'm creating a program with database and it almost done. The only one thing that left is the backup and restore of database. I don't know how to do this. Any help would be appreciated.
Replies To: How to backup and restore mysql database using vb.net
#2
Re: How to backup and restore mysql database using vb.net
Posted 17 March 2012 - 12:26 AM
#3
Re: How to backup and restore mysql database using vb.net
Posted 17 March 2012 - 03:11 AM
At a glance, this seems like it could be useful:
http://webcheatsheet...kup_restore.php
It uses the command line so it is really up to you to decide if you want to muck around with it.
http://webcheatsheet...kup_restore.php
It uses the command line so it is really up to you to decide if you want to muck around with it.
#4
Re: How to backup and restore mysql database using vb.net
Posted 17 March 2012 - 07:27 AM
You could just write your own separate application to grab all the data from the database, and store it into a back up one whenever you want it, or in intervals.
#5
Re: How to backup and restore mysql database using vb.net
Posted 17 March 2012 - 09:44 AM
I found the solution.
Thanks for the replies
Thanks for the replies
#6
Re: How to backup and restore mysql database using vb.net
Posted 17 March 2012 - 10:24 AM
Please be kind enough to share your solution here. It would help someone in the future who wants to do the same.
I'm new to MySQL myself. It would be useful to know how to do it without using commands.
I'm new to MySQL myself. It would be useful to know how to do it without using commands.
This post has been edited by nK0de: 17 March 2012 - 10:25 AM
#7
Re: How to backup and restore mysql database using vb.net
Posted 17 March 2012 - 10:29 AM
I want to state for those who think Mysql and SQL are the same, they are not.
#8
Re: How to backup and restore mysql database using vb.net
Posted 17 March 2012 - 11:46 PM
nK0de, on 17 March 2012 - 10:24 AM, said:
Please be kind enough to share your solution here. It would help someone in the future who wants to do the same.
I'm new to MySQL myself. It would be useful to know how to do it without using commands.
I'm new to MySQL myself. It would be useful to know how to do it without using commands.
Okay. To anyone who has the same problem here's the code
FOR BACKUP:
Process.Start("[PATH WHERE YOU CAN FIND THE MySQLdump.exe]", " -u [USERNAME] -p[YOUR PASSWORD] [DATABASE THAT YOU WANT TO BACKUP] -r ""[PATH WHERE YOU WANT TO SAVE YOUR BACKUP]""")
Example
Process.Start("C:\xampp\mysql\bin\mysqldump.exe", " -u root -pPASSWORD test -r ""C:\xampp\mysql\database backup\backup.sql""")
FOR RESTORE:
Dim myProcess As New Process()
myProcess.StartInfo.FileName = "cmd.exe"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.WorkingDirectory = "C:\xampp\mysql\bin\"
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.Start()
Dim myStreamWriter As StreamWriter = myProcess.StandardInput
Dim mystreamreader As StreamReader = myProcess.StandardOutput
myStreamWriter.WriteLine("mysql -u [USERNAME] -p[YOUR PASSWORD] [DATABASE] < [PATH WHERE YOUR BACKUP LOCATED]")
myStreamWriter.Close()
myProcess.WaitForExit()
myProcess.Close()
Example
Dim myProcess As New Process()
myProcess.StartInfo.FileName = "cmd.exe"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.WorkingDirectory = "C:\xampp\mysql\bin\"
myProcess.StartInfo.RedirectStandardInput = True
myProcess.StartInfo.RedirectStandardOutput = True
myProcess.Start()
Dim myStreamWriter As StreamWriter = myProcess.StandardInput
Dim mystreamreader As StreamReader = myProcess.StandardOutput
myStreamWriter.WriteLine("mysql -u root -pPASSWORD test < C:\xampp\mysql\database backup\backup.sql")
myStreamWriter.Close()
myProcess.WaitForExit()
myProcess.Close()
I hope it helps
I own nothing, I just found it by searching. Credit to original coder.
#9
Re: How to backup and restore mysql database using vb.net
Posted 17 March 2012 - 11:49 PM
Thanks.
#10
Re: How to backup and restore mysql database using vb.net
Posted 17 March 2012 - 11:54 PM
You're welcome
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|