-1

I just created a user account for myself to access only the MariaDB database I just created ("publications") using XAMPP on a Windows 10 PC.

I did this by using the code at the end of this post.

I then try to sign into the database by using this path and command in the command prompt:

C:\xampp\mysql\bin\mysql -u steve -p

It then prompts me for a password, but when I enter the password I get the error

"ERROR 1045 (28000): Access denied for user 'steve'@'localhost' (using password: YES)"

I know the password is correct because I created it.

Note that this is NOT a root-level password; it should only work for the "publications" database.

Strangely, I can just bypass the password requirement by hitting "enter," but I want access to this database to be password-protected, but when I DO enter the password, I get the error!

Why am I getting this error? Do I need to reset my password? If so, how?

Thanks!

Code I entered:

GRANT ALL ON publications.* TO 'steve@localhost'
IDENTIFIED BY 'password';
Mad Physicist
  • 76,709
  • 19
  • 122
  • 186
  • Possible duplicate of [MySQL ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)](http://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw) – Ken White Jun 14 '16 at 03:11

1 Answers1

1

After you entered command:

mysql>GRANT ALL ON publications.* TO 'steve'@'localhost';

Then flush:

mysql> FLUSH PRIVILEGES;

Try login again.

Note: make sure you created an user as follow command:

CREATE USER 'steve'@'localhost' IDENTIFIED BY 'passpass';

and note:

'steve@localhost' 

or

'steve'@'localhost'

on GRANT ALL command

Thanh Nguyen Van
  • 6,018
  • 4
  • 20
  • 34
  • `FLUSH PRIVILEGES` is only needed when modifying the `mysql.*` tables directly. Right after a `GRANT` it is a no-op as `GRANT` takes care of flushing itself already. The "make sure @ is not enclosed by quotes" part is valid though. A quick `SELECT user, host FROM mysql.user;` should show if there's a correct steve/localhost entry, or one with "steve@localhost" as username and no host ... – Hartmut Holzgraefe Jun 15 '16 at 14:51
  • Thanks so much Mr. Holzgraefe! The "SELECT user" lookup did the trick. Indeed I didn't enter my username correctly (wrapped the whole thing in a single set of quotes). – Hoppingvampireprogrammer Jun 16 '16 at 02:24