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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -