How to create mysql dump with Java on Linux system? -


i have make backups of mysql database in application.

i run command in windows , works nice. command:

string executecmd = mysqldumppath +" -u " + dbusername + " -p" + dbpassword + " --add-drop-database -b " + dbname + " -r " + filepath; runtime.getruntime().exec(executecmd); 

when try command on linux server, need put sudo password. how pass password in command line?

i had read many solutions no success.

either run java program root (with sudo) or pass sudo password via stdin sudo (very insecure, practically no secure way implement this).


Comments

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -