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:
1chmod 600 ~/.my.cnf And done. We can now use it:
1mysqldump mydatabase mysqldump is going to read the credentials from that file.
How to install MySQL server in Ubuntu It’s pretty simple:
1sudo apt-get install mysql-server How to connect to MySQL using Java This is a useful and simple snippet:
1import java.sql.Connection; 2import java.sql.DriverManager; 3public class Test { 4 public static void main(String[] args) { 5 try { 6 Class.forName("com.mysql.jdbc.Driver"); 7 Connection c = DriverManager.getConnection( 8 "jdbc:mysql://localhost/?user=root&password="); 9 c.close(); 10 System.out.println("Success"); 11 } 12 catch (Exception e) { 13 e.printStackTrace(); 14 } 15 } 16} How to connect to MySQL using C# Go to http://www.