LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mysql new user access denied error. (https://www.linuxquestions.org/questions/linux-newbie-8/mysql-new-user-access-denied-error-797350/)

knockout_artist 03-23-2010 01:11 PM

mysql new user access denied error.
 
Hi,

Its a mysql question but most linux user would know it so I am posting.

I created a new user

Code:


mysql> INSERT INTO user(Host,User,Password) VALUES('%','fake',PASSWORD('fake'));
Query OK, 1 row affected, 3 warnings (0.00 sec)

mysql> exit

But when I try to log in
Code:

~]# mysql -u fake -p

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

 ~]#

Where should I start looking to fix this?

Thanks

rweaver 03-23-2010 01:26 PM

If you set the user up as 'localhost' instead of '%' does it work?

knockout_artist 03-23-2010 02:13 PM

I tried adding another id.

Code:


mysql> INSERT INTO user(Host,User,Password) VALUES('localhost','fake2',PASSWORD('fake'));
Query OK, 1 row affected, 3 warnings (0.00 sec)

mysql> exit
Bye

Code:

~]# mysql -u fake2 -p
Enter password:
ERROR 1045 (28000): Access denied for user 'fake2'@'localhost' (using password: YES)


divyashree 03-23-2010 02:34 PM

Quote:

Originally Posted by knockout_artist (Post 3909312)
Hi,

Its a mysql question but most linux user would know it so I am posting.

I created a new user

Code:


mysql> INSERT INTO user(Host,User,Password) VALUES('%','fake',PASSWORD('fake'));
Query OK, 1 row affected, 3 warnings (0.00 sec)

mysql> exit

But when I try to log in
Code:

~]# mysql -u fake -p

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

 ~]#

Where should I start looking to fix this?

Thanks



Its too simple brother ,
You have to flush the privileges to make mysql reread the user table,
so after inserting just do it;

Quote:

mysql>flush privileges;
Now you can login without any error .

knockout_artist 03-23-2010 03:05 PM

yes!!!!!!!!!!!!!!!!


that's way I like LQ.

chrism01 03-23-2010 07:09 PM

You'd be better off using the GRANT cmd; you're not really supposed to mess with the users table directly.
http://dev.mysql.com/doc/refman/5.0/en/grant.html


All times are GMT -5. The time now is 11:40 AM.