MySQL Tip: CLI Authentication Bypass Password

Quick tip to those new to managing a the MySQL database or even those that have been doing it for years. You do not need to authenticate with your username and password everytime.

In order to skip this all you need to do is setup $HOME/.my.cnf as such:


Then when you enter the MySQL console all you need to do is run:

[[email protected] modern]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 647
Server version: 5.6.25 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

and tada no need to mess with passing arguments for username and password.

Write a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.