0

Extremely basic question but I'm pulling my hair out trying to figure this out:

mysql> create database hellodb;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on hellodb to hellouser identified by '123';
Query OK, 0 rows affected (0.00 sec)

mat@admin:~$ mysql -u hellouser hellodb -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'hellouser'@'localhost' (using password: YES)

This is an Amazon EC2 instance so there are complications. There's an internal IP address and an external IP address, and MySQL can only be set up to listen on one of them. I've chosen the external IP address. But I don't think this matters: the above commands should work, and I've tried all variants of host address I can think of (localhost, internal ip, external ip, fqdn, %).

This is Ubuntu Trusty, so things usually Just Work (as opposed to Debian and its "broken by default for your peace of mind" design strategy.)

Is there any way to debug these "Access denied" error messages? Is there a way to debug if MySQL is unhappy about the password, or the IP address, or the user name, or the privileges?

There are innumerable possible combinations that can cause this problem, and googling shows vast confusion over this. If there was some way to tease apart the actual cause that would be really helpful.

1
  • SELECT * FROM mysql.user WHERE user = ''; Anything found? Note also that listening on 0.0.0.0 listens on all interfaces. Feb 17, 2017 at 2:35

1 Answer 1

1

Instead of this statement

grant all privileges on hellodb to hellouser identified by '123';

Try this one below ->

grant all privileges on hellodb.* to 'hellouser'@'localhost' identified by '123';
1
  • Gah, that simple, just missing out the ".*"! I wonder what the command I actually ran does? Feb 17, 2017 at 10:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .