我使用此代码创建数据库的转储文件。 现在我想要的是,如果可能的话,加密它,以便在记事本或类似的东西中查看它时,普通用户无法读取它。
Call isDirectoryExist()
Call createDbBackupName()
Dim myProcess As Process = New Process
Dim strUser As String = "superadmin"
' MsgBox(" --host=localhost --user='" & strUser & "' --password """ & strDbName & """ -r """ & strPath & newDBName & """ ")
Process.Start("C:/MySQL/bin/mysqldump.exe", " --host=localhost --user='" & strUser & "' --password=1234 """ & strDbName & """ -r """ & strPath & newDBName & """ ")
我也可以选择恢复这些文件。使用这些代码。
Dim strm As System.IO.Stream
strm = ofpSQL.OpenFile
txtRestore.Text = ofpSQL.FileName.ToString
If Not (strm Is Nothing) Then
Dim dbToRestore As String = ofpSQL.FileName.ToString
Dim myProcess As New Process()
myProcess.StartInfo.FileName = "cmd.exe"
myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.WorkingDirectory = "C:\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 superadmin --password=1234 """ & strDbName & """ < """ & ofpSQL.FileName.ToString & """ ")
myStreamWriter.Close()
myProcess.WaitForExit()
myProcess.Close()
strm.Close()
End If
当然,如果加密,则必须在查询转储文件之前对其进行解密。
我不知道我在vb.net和mysql中可以做什么加密
无论如何,如果我碰巧知道一个,我不知道我怎么能用它。 任何帮助和输入都将非常有用。
提前致谢。
我修改了我的第一个代码
Process.Start("C:/MySQL/bin/mysqldump.exe", " --host=localhost --user='" & strUser & "' --password=1234 """ & strDbName & """ -r """ & strPath & newDBName & """, --cipher /e /a '" & newDBName & "' ")
但输出文件中没有包含任何内容。 TIA
答案 0 :(得分:0)
将您的代码更改为此
Process.Start("C:/MySQL/bin/mysqldump.exe", " --host=localhost --user='" & strUser & "' --password=1234 """ & strDbName & """ -r """ & strPath & newDBName & """")
Process.WaitForExit()
Process.Start("C:\Windows\System32\cipher.exe", "/e /a '" & strPath & newDBName & "' ")