0

I'm new to mySQL so bear with me. I'm using Windows 10, EasyPHP 13.1.

I've been reading up on MySQL, and I'm currently at the point were I'm creating a user.

I used the following code, to grant permission to the jim user

   GRANT ALL ON publications.* TO 'jim' IDENTIFIED BY 'mypasswd'

I exited out of MySQL and attempted to log in again with the password above. I keep getting the following error message "Error 1045 (28000) for user 'jim'@'localhost' (using password YES)" I did some research concerning the problem and ran into this: MySQL ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)

I had trouble with this, so I'm not exactly sure what an anonymous user is? The responder recommends to drop the anonymous user but how does one go about doing that? I was skeptical of the other answers as they were recommending practices that are considered dangerous (Judging from the comments).

How does one go about solving this problem.

Community
  • 1
  • 1

2 Answers2

1

You did not specify host information for you login. Try below for connecting only from localhost. GRANT ALL ON publications.* TO 'jim'@'localhost' IDENTIFIED BY 'mypasswd'; Or below for connecting from everywhere. GRANT ALL ON publications.* TO 'jim'@'%' IDENTIFIED BY 'mypasswd'

  • Thank you, this is the right solution. Quick clarification, by "connect from everywhere", do you mean its possible to access the same database on another machine at a different location? –  Mar 13 '16 at 16:48
  • I think you misunderstood. From everywhere means with 'jim'@'%' login you can access your database from all hosts. But with 'jim'@'localhost' this login only from localhost. 'jim'@'10.10.10.10' with this login only from host with 10.10.10.10. ip address defined. Sorry for bad english :) – Yusif Yusifov Mar 14 '16 at 06:24
1

You are probably reading the chapter 8, edition 2-3 of the book of Robin Nixon "Create dynamic websites by using: PHP, MySQL, JavaScript, CSS and HTML5".

I would advise you to find/buy English version. In the new 4th edition, the author has fixed this issue:

GRANT ALL ON publications.* TO 'jim'@'localhost' IDENTIFIED BY 'mypasswd';

But it's sort of bad practices since new user should be not "auto-created" with the GRANT command. For this you have another command:

CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'mypass';
Félix Gagnon-Grenier
  • 7,344
  • 10
  • 45
  • 58
Dmitry
  • 11
  • 3