LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-23-2010, 01:11 PM   #1
knockout_artist
Member
 
Registered: Sep 2005
Distribution: fedora core 9
Posts: 324

Rep: Reputation: 33
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
 
Old 03-23-2010, 01:26 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 164Reputation: 164
If you set the user up as 'localhost' instead of '%' does it work?
 
Old 03-23-2010, 02:13 PM   #3
knockout_artist
Member
 
Registered: Sep 2005
Distribution: fedora core 9
Posts: 324

Original Poster
Rep: Reputation: 33
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)
 
Old 03-23-2010, 02:34 PM   #4
divyashree
Senior Member
 
Registered: Apr 2007
Location: bbsr,orissa,India
Distribution: RHEL5 ,RHEL4,CENT OS5,FEDORA,UBUNTU
Posts: 1,363

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by knockout_artist View Post
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 .
 
Old 03-23-2010, 03:05 PM   #5
knockout_artist
Member
 
Registered: Sep 2005
Distribution: fedora core 9
Posts: 324

Original Poster
Rep: Reputation: 33
yes!!!!!!!!!!!!!!!!


that's way I like LQ.
 
Old 03-23-2010, 07:09 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,294

Rep: Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql --- Access denied for user 'test'@'localhost' permalac Linux - Server 15 03-05-2013 08:51 PM
mysql server ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using pas tarak420 Linux - Server 2 09-18-2008 09:52 PM
MySQL: 'access denied for user' turbo_acura Linux - General 1 10-20-2004 08:34 AM
mySQL Access denied for user Gerardoj Linux - General 2 03-21-2004 10:13 AM
MYSQL access denied for user c0c0deuz Linux - General 1 03-18-2003 02:44 PM


All times are GMT -5. The time now is 01:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration