Solved

mysqldump - output.

Posted on 2010-09-01
7
2,080 Views
Last Modified: 2012-05-10
Hi

 I have a batch DOS where i put this
"%mysqldir%\bin\mysqldump" --user=%dbuser% --password=%dbpass% database > "%bkupdir%\%fn%_backup.sql"

It works and the file .sql is created with the data. Is it possible to have any output once the mysqldump is finished, something like 8 tables backup, 60 MB or more over if there is an error .


Thanks.
0
Comment
Question by:workflow80
  • 2
  • 2
7 Comments
 
LVL 12

Expert Comment

by:mcv22
ID: 33580284
Try using the --verbose , --show-progress-size

http://bugs.mysql.com/bug.php?id=44071

Errors should show by default. You can log those to a file using --log-error=file_name

http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_log-error
0
 

Author Comment

by:workflow80
ID: 33647168
I have this error when I run :

"%mysqldir%\bin\mysqldump" --user=%dbuser% --password=%dbpass% database > "%bkupdir%\%fn%_database.sql" --show-progress-size=1500  --verbose >out.sql --log-error=errordata.txt

mysqldump: unknown variable 'show-progress-size=1500'
0
 

Author Comment

by:workflow80
ID: 33647325
Also, inside my batch , i've changed the command like this :

"%mysqldir%\bin\mysqldump" --user=%dbuser% --password=%dbpass% --verbose >out.sql database >"%bkupdir%\%fn%_data.sql"  
The output is not created but my data dump file is created .
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 33697612
The --verbose from MySQL doesn't have an option to output to file that I know of, so what I would do (tested to work) is to redirect DOS output which is where the results of --verbose is being displayed/output.

Note the 2>{output.log} portion AND, no, the 2 is not a type-o. :)
What will also work is 1>{output.log} 2>&1 << this will pipe the standard output to file path specified and the 2>&1 will redirect standard error to same file as standard output.  I found with mysqldump --verbose that the standard error is what is utilized, but the second example probably your best method to use if going to add other options to try to get more detail although I am not sure which other may be helpful to you than the --verbose ... just matters what all you need.

References:
http://www.robvanderwoude.com/battech_redirection.php << command line redirection
http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html << mysqldump options

Hope that helps!
mysqldump.exe --user={username} --password={password} --verbose --result-file={output.sql} database 2>{output.log}

Open in new window

0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33697714
By the way, I like to use this format:

mysqldump -u root -p

This way, I never have to pass or store password in clear text as the command will prompt you on the next line and will use the * (hidden) entry format.  Just a tidbit if you were not already aware.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now