Mysql – Default user Accounts in Mysql


I'm new to MySQL and installed MySQL in Ubuntu 16.04. At the time of installation I have given password for root.

In the terminal I can access only root user and created user only.

bharath@bharath-desktop:~$ mysql -uroot -pbharath

mysql: [Warning] Using a password on the command line interface can be
insecure. Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7 Server version: 5.7.16-0ubuntu0.16.04.1

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input


But I am not able to access the default MySQL user in the terminal. It shows like this:

bharath@bharath-desktop:~$ mysql

ERROR 1045 (28000): Access denied for user 'bharath'@'localhost'
(using password: NO)**

If I hit enter after MySQL, it's not authenticated. How to access this?

Best Answer

As far as I can tell, the default users for a fresh mysql server is root@localhost and mysql.sys@localhost, you'll need to create a bharath@localhost user and create a .my.cnf under your $HOME folder with the following contents: