MySQL backup with mysqldump
Unknown1:00 AM 0 comments

If the foregoing I have discussed with backup mysql with script in Visual Basic now I will discuss backing up the mysql database with the help of mysqldump.exe program which is inherited from the mysql server. but also combined with script2 in visual basic. Immediately, you just discussed, you must install the mysql server (must have installed it already had a database), then you are looking for mysqldump program and you copy to the folder where your Visual Basic. if you've just created his project.

project consists of a project and a form and a CommandButton
please copy and paste this code.

Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Private Const SYNCHRONIZE = &H100000
Private Const INFINITE = -1&
Dim FileNama As String
Sub BuatBAT()
Open App.Path + "\Backup.bat" For Output As #1
Print #1, Tab(1); "mysqldump.exe --user=root --password=dikosongi --host=localhost --databases kkpi --opt --quote-names --allow-keywords --complete-insert --add-drop-database --hex-blob> c:\kkpi.sql"
Close #1

End Sub
Private Sub ShellAndWait(ByVal program_name As String)
Dim process_id As Long
Dim process_handle As Long

process_id = Shell(program_name, vbHide)
DoEvents
' Wait for the program to finish.
' Get the process handle.
process_handle = OpenProcess(SYNCHRONIZE, 0, process_id)
If process_handle <> 0 Then
WaitForSingleObject process_handle, INFINITE
CloseHandle process_handle
End If
' Reappear.
End Sub
Private Sub Command1_Click()
BuatBAT
ShellAndWait App.Path + "\Backup.bat"
kill App.Path + "\Backup.bat"
End Sub


Dood Luck :D
All In One
About The Author Ali Bajwa Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore. Magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Facebook and Twitter

0 comments

Post a Comment