I was setting up mysql on my prod server, this is actually the first time i set up a prod installation of mysql.
I've logged in as root, created my DBs, and then i've created 2 users as follow:
User1/permissions on database1
CREATE USER 'jhon'@'localhost' IDENTIFIED BY 'passwd';
GRANT CREATE ON database1 TO 'jhon'@'localhost';
GRANT INSERT ON database1.* TO 'jhon'@'localhost';
GRANT SELECT ON database1.* TO 'jhon'@'localhost';
GRANT UPDATE ON database1.* TO 'jhon'@'localhost';
User2/permissions on database2
CREATE USER 'jhonjhon'@'localhost' IDENTIFIED BY 'passwdpasswd';
GRANT CREATE ON database2 TO 'jhonjhon'@'localhost';
GRANT INSERT ON database2.* TO 'jhonjhon'@'localhost';
GRANT SELECT ON database2.* TO 'jhonjhon'@'localhost';
GRANT UPDATE ON database2.* TO 'jhonjhon'@'localhost';
and then
FLUSH PRIVILEGES;
exit;
Now i'm trying to log in as 'jhon' or 'jhonjhon', with the command:
mysql -u jhon -p
but both attempts give me
ERROR 1045 (28000): Access denied for user 'jhon'@'localhost' (using password: YES)
I've also tried to select the database directly with -D option, accordingly with the permissions set above..but nothing, Mysql still denies access.
Where am i wrong?
thanks
EDIT
Users List:
| root | 127.0.0.1 |
| root | ::1 |
| debian-sys-maint | localhost |
| root | localhost |
| jhon | localhost |
| jhonjhon | localhost |
System Info:
Ubuntu 14.04 LTS - MYSQL Ver 14.14 Distrib 5.5.43