Solved

mysqldump - output.

Posted on 2010-09-01
7
2,295 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 60

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 60

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

Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
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…

738 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