INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Mysqldump.exe

Mysqldump.exe

(OP)
I am trying to use mysqldump.exe in a .bat file from Windows but I cannot get the right code

I am using: mysqldump.exe –e –u root -p -h localhost testdb > G:\backup.sql

G: is a drive in the same computer
In what directory do I place this batch file?
What is wrong?

RE: Mysqldump.exe

Quote (Bersani)

What is wrong?

Until we know what is, or is not happening, it's impossible to say.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: Mysqldump.exe

What error are you getting?

Going by the exe extension on mysqldump I'll assume this is happening on Windows in which case I'll also assume your batch file is not located in the same folder as mysqldump so it can't find it.

Of course this is all guess work.

Perhaps if you tell us more about where you are running this and what error you are getting we may be able to help.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

RE: Mysqldump.exe

(OP)
I placed a copy of mysqldump.exe in the data folder.

RE: Mysqldump.exe

Again, without telling us what error you get or what is happening its going to be very difficult to help.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

RE: Mysqldump.exe

(OP)
I get a command prompt window that opens and closes instantly. I get the file backup.sql with no content (0 ).

RE: Mysqldump.exe

Quote:


I get a command prompt window that opens and closes instantly

That is expected behavior. When opening a command prompt window by double clicking a bat file, the window will close when the bat file is done.

Try running the bat file in a command prompt window directly by going to Start, and typing "cmd" (without the quotes) in the search bar and clicking on the cmd icon that comes up.

Then change directory to the location of the bat file and try to run it. This should at least let you see the errors.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

RE: Mysqldump.exe

(OP)
I tried but the window closes before I can see the error. I see that there is an error message but it disappears.

RE: Mysqldump.exe

(OP)
I finally got to see the error message: "error 1045 access denied for user 'ODBC'@localhost < using password: YES> when trying to connect"

I entered the correct password

RE: Mysqldump.exe

Again, open a cmd window from the start menu. so it doesn't close.

If you double click the bat file it will close the window. Don't double click the bat file at all.

Open a command Prompt directly. Start->Search "cmd". With that command window open. Use the command prompt commands to navigate to the folder in the window.
i.e.

CODE

C:\> cd foldername [enter] 

Then run the bat file in that window:
i.e

CODE

C:\> batfilename.bat [enter] 

Running it like this will, prevent the window from closing.






----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

RE: Mysqldump.exe

Have you tried running a test with the password in the command line?



Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: Mysqldump.exe

(OP)
It finally worked. Thank you for your help. It prompts me for the password. Is there a way to avoid the prompt?
mysqldump -u root -p testdb > G:\backup.sql

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close