Solved

mysqldump - output.

Posted on 2010-09-01
7
2,225 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
Creating and Managing Databases with phpMyAdmin in cPanel.
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…

789 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