Why is MySQL not connecting when reading from mylogin.cnf?
There is a bug here.
You can check your .conf file permissions.
The root cause of crashes or other unexpected behavior will be in the error logs. The default path of the MySQL log file is /var/log/mysql/error.log on Ubuntu.
Also for debugging check this out.