MySQL allows you to store credentials in a file called ~/.my.cnf. The contents can look like this:
[mysqldump] user=myuser password=mypassword We have to modify the file permissions and give read/write permissions to the owner only:
chmod 600 ~/.my.cnf And done. We can now use it:
mysqldump mydatabase mysqldump is going to read the credentials from that file.
How to install MySQL server in Ubuntu It’s pretty simple:
sudo apt-get install mysql-server How to connect to MySQL using Java This is a useful and simple snippet:
import java.sql.Connection; import java.sql.DriverManager; public class Test { public static void main(String[] args) { try { Class.forName("com.mysql.jdbc.Driver"); Connection c = DriverManager.getConnection( "jdbc:mysql://localhost/?user=root&password="); c.close(); System.out.println("Success"); } catch (Exception e) { e.printStackTrace(); } } } How to connect to MySQL using C# Go to http://www.