ERROR 1045 (28000): Access denied for user ‘myuser’@’myhost.xx.oracle.com’ (using password: YES)

From the local machine, I tried to connect the local mysql database:

-bash-4.2$ mysql –host= –user=myuser –password=mypwd mydb
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user ‘myuser’@’myhost.xx.oracle.com’ (using password: YES)

However remotely it worked!!!

The cause:

http://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw

Before:
mysql> select user,host from mysql.user;
+——+————————+
| user | host |
+——+————————+
| myuser | % |
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| root | localhost |
| | myhost.xx.oracle.com |
| root | myhost.xx.oracle.com |
+——+————————+
7 rows in set (0.00 sec)

After:
mysql> select user, host from mysql.user;
+——+———–+
| user | host |
+——+———–+
| myuser | % |
| root | 127.0.0.1 |
| root | ::1 |
| root | localhost |
+——+———–+

And, don’t forget to flush privileges;