I can connect to mysql using the following line:
mysql -u myusername -p
(enters password into terminal)
>>>Welcome to the MySQL monitor. Commands end with ; or \g.
>>>Your MySQL connection id is 51
>>>Server version: 5.6.10-log Source distribution
Here is my .my.cnf in my home directory (not /etc/my.cnf):
[client]
user = myusername
password = mypassword
host = localhost
There also appears to be a client section in my /etc/my.cnf:
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
However when I just type "mysql" into the terminal, I get:
ERROR 1045 (28000): Access denied for user 'myusername'@'localhost' (using password: YES)
What is wrong with my my.cnf?
ALso, it has nothing to do with anon user as mentioned here: MySQL ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)
Here is the result of a suggested query:
>>>mysql --print-defaults
>>>mysql would have been started with the following arguments:
>>>--port=3306 --socket=/tmp/mysql.sock --no-auto-rehash --user=myusername --password=mypassword --host=localhost