0

I get this error when I try to access my database via the user 'spot'@'localhost' identified by its password.

PermissionsError: (1045, "Access denied for user 'spot'@'localhost' (using password: YES)", None)

I create this user using these two lines:

create user 'spot'@'localhost' identified by 'fakepasswd';
grant all privileges on *.* to 'spot'@'localhost';

When I run this code locally, it works fine. When I run this code on a different machine, I get the aforementioned error. Yet when I run show grants for 'spot'@'localhost' on both machines, they both give me the same output:

 GRANT ALL PRIVILEGES ON *.* TO 'spot'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4FRO4CA44C47D54D78478C7E2BD7B7'

How can I debug this access problem?

Rose Perrone
  • 61,572
  • 58
  • 208
  • 243

1 Answers1

0

Yo need to grant privileges not only from localhost, run this querys:

create user 'spot'@'%' identified by 'fakepasswd';
grant all privileges on *.* to 'spot'@'%';
flush privileges;

This allow the user to connect from ANY ip, you can replace the % with the ip of your server.

Sal00m
  • 2,938
  • 3
  • 22
  • 33