Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why Shell not allow to run mysql Utility ?

Status
Not open for further replies.

jonybd

Programmer
Nov 3, 2002
166
BE
VB code to backup / recovery/ drop / create database.

/////////////////////////////////////////////////////////
Backup & Recovery function not working can anybody tell why ? 1st two function working from module1 , but how to
let other 2 function work.
/////////////////////////////////////////////////////////

Global exePath As String
Global exeCmd As String
Global dBase As String

Global bPath As String
Global rPath As String

Function dRop()
Shell ("C:\mysql\bin\mysqladmin drop test")
'Shell (exePath & "\" & exeCmd & ".exe " & "-f drop " & dBase)
End Function

Function cReate()
Shell ("C:\mysql\bin\mysqladmin create test")
'Shell (exePath & "\" & exeCmd & ".exe " & "-f create " & dBase)
End Function

Function bAckup()
Shell "C:\mysql\bin\mysqldump --opt -u root test > f:\vbSql.sql", vbNormalFocus
'Shell (exePath & "\mysqldump.exe " & "--opt -u root " & dBase & " > " & bPath)
End Function

Function reCover()
Shell &quot;C:\mysql\bin\mysql -u root test < f:\inforev.sql&quot;
'Shell (exePath & &quot;\mysql.exe &quot; & &quot;-u root &quot; & dBase & &quot; < &quot; & rPath)
End Function
 
It looks Ok to me.

have you checked that the variables bPath and rPath are correctly storing destination and retrieval path?

Readin your posting I figure that your root user has no password. If I am not correct then this would explain.
Bye

Qatqat



Life is what happens when you are making other plans.
 
If your root user has no password then I'd recommend to change that ASAP and create a user that performs the required functions.
Having the root user without password is a gaping security hole and can be potentially taken advantage of. With the root user not properly constrained anyone can do anything to your MySQL data.
 
i used without password from command line. it works fine
even i worked that out useing borland c++

#include <stdio.h>
#include <conio.h>
#include <windows.h>

void main()
{
system(&quot;c:\\mysql\\bin\\mysqldump.exe -u root database > F:\\backup.sql&quot;);
getch();

///////// works fineeeeeeeeeeeeee ////////////
but i have to use it in visual basic where i dont know how to useing system , where i know how to use winexec, shellexecute, shellexecuteex
}
 
This was programmeing code problem where
i use ing now

shell(&quot;cmd.exe /c c:\mysql\bin\mysqldump.exe -u root database > f:\blab.sql&quot;)

' will not work ,
shell(&quot;command.com /c c:\mysql\bin\mysqldump.exe -u root database > f:\blab.sql&quot;)

shell(&quot;c:\mysql\bin\mysqldump.exe -u root database > f:\blab.sql&quot;)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top