Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


how to backup and restore


how to backup and restore

Author
Message
chaw12
chaw12
Forum God
Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)

Group: Forum Members
Posts: 70, Visits: 232
Hi..

can any one please tell me whats wrong with this code...



Open "C:\sample.bat" For Output As #1

Dim str As String

str = "mysql path\bin\mysqldump.exe --host=localhost --user=user --password=pass --database=dbase -r> c:\bck.sql"

Print #1, ComandoSh

Close 1

ProcId = Shell("C:\bck.bat", vbHide)



it only create a text file and bck.sql but it has no record at all.

im using mysql 5.1

thanks

Mark
Mark
Forum God
Forum God (142K reputation)

Group: Moderators
Posts: 1.1K, Visits: 11K
You have this line in your code.
Print #1, ComandoSh

What is ComandoSh? I don't see it declared or a value being set for it anywhere. Should the line read...
Print #1, str

chaw12
chaw12
Forum God
Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)

Group: Forum Members
Posts: 70, Visits: 232
yes.. sorry i just change it and i forgot to change it also. it should be str..



can you please tell me why it create a 0 bytes file? im using mysql 5.1.



thank you
Perrie
Perrie
Forum God
Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)Forum God (3.8K reputation)

Group: Forum Members
Posts: 13, Visits: 308
using str as a variable name could be the problem as str is reserved keyword for the function to convert numerical values into a string variable

ie

Dim L as String,N as integer

N=26

L=Str(N)    <--- L now is "26"

Mark
Mark
Forum God
Forum God (142K reputation)

Group: Moderators
Posts: 1.1K, Visits: 11K
If you run

mysql path\bin\mysqldump.exe --host=localhost --user=user --password=pass --database=dbase -r> c:\bck.sql

from a command prompt does it work? Is the database parameter correct or should it be databases?

chaw12
chaw12
Forum God
Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)

Group: Forum Members
Posts: 70, Visits: 232
Hi. sorry for the late reply..



well i did try running it on the command and it gives the output like the help list on the command prompt when we type the prompt/?.

it did not back up the database..



thank you for your reply
Mark
Mark
Forum God
Forum God (142K reputation)

Group: Moderators
Posts: 1.1K, Visits: 11K
That to me means you are using the wrong syntax. Keep running it from the command prompt until you get it working then it should be easy to add it to your code. Like my previous message I would try databases instead of database as your parameter.

Instead of this

mysql path\bin\mysqldump.exe --host=localhost --user=user --password=pass --database=dbase -r> c:\bck.sql

try this

mysql path\bin\mysqldump.exe --host=localhost --user=user --password=pass --databases=dbase -r> c:\bck.sql

Edited
3/28/2011 by Mark
chaw12
chaw12
Forum God
Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)

Group: Forum Members
Posts: 70, Visits: 232
thanks again.



i tried adding an S on the database and same output was generated. the bck.sql contains the help file of MySQL but not the database.
Mark
Mark
Forum God
Forum God (142K reputation)

Group: Moderators
Posts: 1.1K, Visits: 11K
Does this work?

Note: It is intentional that there is no space between the -p parameter and the password.

mysql path\bin\mysqldump.exe -user user -ppass dbase > bck.sql

This is based on this page
http://www.webcheatsheet.com/SQL/mysql_backup_restore.php

chaw12
chaw12
Forum God
Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)Forum God (21K reputation)

Group: Forum Members
Posts: 70, Visits: 232
Hi. thanks for your reply...



thank you for the link... everything was clear to me now. and i already solved my problem

thanks for all of your help.



thanks and God bless!
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search