-1

If I try to login this way, it works.

$ mariadb --user blogbot -p"password"

If I try to login this way, it doesn't work.

$ mariadb --user blogbot -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'blogbot'@'localhost' (using password: YES)

I tried many times both typing and pasting the password, and it seems clear to me that the problem is with the method.


What do you think this might be due to? I just noticed the password includes a ', is this prohibited in a password?

11
  • A single quote character is not prohibited in a DB password, but quote mark characters can give you this kind of trouble. I would suggest changing the password to one that doesn't have quotes in it. Commented Feb 15 at 19:39
  • 1
    If ' were prohibited it wouldn't work on the command line, either. Commented Feb 15 at 19:39
  • Yes @tink, I was thinking the same. So, is there any other possible reason behind this that we know? Commented Feb 15 at 19:44
  • @FLAK-ZOSO ... I can't really. Have you tried putting the -p before the user? Like mariadb -p --user bot? I don't use maria (postgres fanboy since the late 90's ;D), so can't test, but I wouldn't be surprised if order mattered. Or use the long-option? Commented Feb 15 at 19:51
  • I tried many combinations but I believe those shouldn't change anything, and in fact they don't. Thank you either ways for the help, this is a somewhat weird problem. Commented Feb 15 at 20:01

1 Answer 1

2

In the comments I suggested that the OP test by changing the DB user's credential so there are no special characters in the password. Then, if that password works both on the command line (-p 'password') and via interactive prompt, then the special characters could be re-introduced one at a time to find the one causing the trouble.

The OP replied, saying that it started working when all the space characters were removed from the password.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.