1

I want to change mysql password periodically and want to register the changes password in a Property file.
Can any one suggest as how to achieve the same?

1 Answer 1

2

Yes, Try to generate a random password with java code and set it as mysql user password by scheduling a cron job or scheduled task by OS and write the same password in property file or mail yourself.. Update the password by java code using this sample code..

String sql = "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456')";
Statement smt = con.createStatement();
smt.executeQuery(sql);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.