avatar

Andres Jaimes

Storing MySQL credentials on a file

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 …

Common tasks when working with MySQL

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 { …