1

所有这些代码都在工作......这是我备份中的代码......

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    Process.Start("C:\xampplite\mysql\bin\mysqldump.exe", " -u root -p db_hrm -r ""C:\Users\Rodmar\Desktop\Desktop.sql""")

End Sub

这是我的恢复代码

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

    Dim myProcess As New Process()
    myProcess.StartInfo.FileName = "cmd.exe"
    myProcess.StartInfo.UseShellExecute = False
    myProcess.StartInfo.WorkingDirectory = "C:\xampplite\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.exe -u root -p db_hrm < C:\Users\Rodmar\Desktop\Desktop.sql")
    myStreamWriter.Close()
    myProcess.WaitForExit()
    myProcess.Close()
    'Process.Start("C:\porgram files\mysql\bin\mysql.exe", "-u username -p password --database=dbname > -r ""C:\back.sql""")

End Sub

问题是。如何备份数据库并选择要保存的文件位置。以及如何将其还原到我保存数据库的位置。

4

0 回答 0