LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-07-2010, 11:47 AM   #1
visitashu
LQ Newbie
 
Registered: Jan 2006
Location: Bangalore : INDIA
Distribution: Ubuntu, RedHat, Gentoo, Linux Mint, Arch Linux, Fedora
Posts: 26

Rep: Reputation: 0
Unhappy Mysql error 1045: Access denied for user 'root'@'localhost' (using password: YES)


Hi,
I was setting up mysql server on my box running Fedora Core 13.
Please see the version below -
" mysql Ver 14.14 Distrib 5.1.51, for redhat-linux-gnu (i386) using readline 5.1 "
I ran /usr/bin/mysql_secure_installation for some configurations
Gave root password, restarted mysqld service and did this -
$ mysql -u root -p
It allowed me to log in.
Then I imported a test.sql db. Rebooted the box.
Now when I tried to login to mysql -
I get the following error even after keying in the correct password.

1045: Access denied for user 'root'@'localhost' (using password: YES)

I have not installed phpmyadmin yet.
I went through MySql forums, didn't find any valuable post
which could solve this. Some said to re-install Mysql,
I did so, it worked perfectly until box was rebooted.
Same error promts when I login next time.

It would be a great if anyone in this forum can support me here.
It has become a blocker for my development work as well.

Many thanks,
 
Old 11-07-2010, 12:11 PM   #2
honeybadger
Member
 
Registered: Aug 2007
Location: India
Distribution: Slackware (mainly) and then a lot of others...
Posts: 855

Rep: Reputation: Disabled
Hi, a very basic question.... are you able to log in as a normal user. If you can do that then try to run su or sudo and become root.
Hope this helps.
 
Old 11-07-2010, 05:07 PM   #3
Flyte
LQ Newbie
 
Registered: Dec 2007
Distribution: Fedora, CentOS, Debian
Posts: 23

Rep: Reputation: 2
Looks like SilverBack got the wrong end of the stick there. The OP said he couldn't log into mysql, not into a console.

Try this http://dev.mysql.com/doc/refman/5.0/...rmissions.html

Not sure why it'd change the root password when you reboot though.

Last edited by Flyte; 11-07-2010 at 05:08 PM.
 
Old 11-08-2010, 12:27 AM   #4
visitashu
LQ Newbie
 
Registered: Jan 2006
Location: Bangalore : INDIA
Distribution: Ubuntu, RedHat, Gentoo, Linux Mint, Arch Linux, Fedora
Posts: 26

Original Poster
Rep: Reputation: 0
Unhappy

@SilverBack
I am not able to get the mysql> promt in both ways -as 'normal' or 'su -'

@Flyte
I did visit that link earlier, it couldn't change mysql password.
Or if it would have changed it is not allowing me in with new password.

When I remove /var/lib/mysql directory and re-install mysql. it works!

I am able to login to mysql, change DB and say >grant all privileges on DB.* to user@localhost identified by pswd;
I get encounter new error -
"ERROR 1133 (42000): Can't find any matching row in the user table"
When I exit out of mysql> and try logging in it doesn't allow. (Error 1045)
 
Old 11-08-2010, 12:40 AM   #5
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
Are you sure you have a password set for the user? If not then try logging without the -p switch and see if you can log into mysql.
 
Old 11-08-2010, 02:01 AM   #6
honeybadger
Member
 
Registered: Aug 2007
Location: India
Distribution: Slackware (mainly) and then a lot of others...
Posts: 855

Rep: Reputation: Disabled
@Chaitanya ---- you got it right mate. I did not know what I was thinking (ssh perhaps). Thanks for pointing the error.
 
Old 11-08-2010, 02:52 AM   #7
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
@Silver:
Yeah monday is anyhow an awful way to spend 1/7th of week. let monday go and you will be back in your senses. Diwali fervour has not sunk in yet with me as well.
 
Old 11-08-2010, 04:56 AM   #8
visitashu
LQ Newbie
 
Registered: Jan 2006
Location: Bangalore : INDIA
Distribution: Ubuntu, RedHat, Gentoo, Linux Mint, Arch Linux, Fedora
Posts: 26

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by linuxlover.chaitanya View Post
Are you sure you have a password set for the user? If not then try logging without the -p switch and see if you can log into mysql.
Yes I have the password set for 'root' user. I run /usr/bin/mysql_secure_installation to do so.
Any more pointers ?

Thanks,
 
Old 11-08-2010, 05:01 AM   #9
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
Okay you rebooted the server. Are you sure the service is running? What does this give you:
Code:
/etc/init.d/mysqld status
or
service mysqld status
 
Old 11-08-2010, 09:00 AM   #10
visitashu
LQ Newbie
 
Registered: Jan 2006
Location: Bangalore : INDIA
Distribution: Ubuntu, RedHat, Gentoo, Linux Mint, Arch Linux, Fedora
Posts: 26

Original Poster
Rep: Reputation: 0
@Chaitanya

After rebooting my box ; /etc/init.d/mysqld says..service is running.
I do check mysqld.pid under /var/run/mysqld/ directory.
I tried killing it and restarting service ; service restarts but my login
issue is not resolved.

Thanks,
 
Old 11-08-2010, 11:23 PM   #11
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
You said you imported some sql script? What script was it? Or was it for creating the database? Do you have by chance, any other user created on mysql with super privileges?
 
Old 11-09-2010, 12:07 AM   #12
visitashu
LQ Newbie
 
Registered: Jan 2006
Location: Bangalore : INDIA
Distribution: Ubuntu, RedHat, Gentoo, Linux Mint, Arch Linux, Fedora
Posts: 26

Original Poster
Rep: Reputation: 0
That was a testdb.sql file which contains some tables / data.
I said : $ mysql -u root -p < testdb.sql
No, I do not have any other user.

Quote:
Originally Posted by linuxlover.chaitanya View Post
You said you imported some sql script? What script was it? Or was it for creating the database? Do you have by chance, any other user created on mysql with super privileges?
 
Old 11-09-2010, 01:37 AM   #13
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

Rep: Reputation: Disabled
Are you sure that sql import did not affect this all? Can you see what that sql script contains?
 
Old 11-09-2010, 09:38 PM   #14
enine
Senior Member
 
Registered: Nov 2003
Distribution: Slackʍɐɹǝ
Posts: 1,486
Blog Entries: 4

Rep: Reputation: 282Reputation: 282Reputation: 282
Same issue here but on slackware. I found this guide http://www.basicconfig.com/linuxserv...ysql_slackware

can sign in fine as root but denied access to do anything.
 
Old 11-10-2010, 10:37 AM   #15
visitashu
LQ Newbie
 
Registered: Jan 2006
Location: Bangalore : INDIA
Distribution: Ubuntu, RedHat, Gentoo, Linux Mint, Arch Linux, Fedora
Posts: 26

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by linuxlover.chaitanya View Post
Are you sure that sql import did not affect this all? Can you see what that sql script contains?
No, I do not think so that sql import has caused any issue. When I re-installed Fedora for third time, I tried with empty .sql file
$ echo "" > blank.sql
$ mysql -u root -p < blank.sql

This got imported and when I logged in to mysql> and logged out of mysql>
I was unable to login for the next time.

But, again as per you said, let me go through main DB .sql file and grep for "user". If this returns something unexpected. I think we are close to results then.

Thanks,
 
  


Reply

Tags
database, fedora, linux, login, mysql



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
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) bobby953 Linux - Software 21 03-24-2011 08:35 PM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) shogun1234 Linux - Server 1 06-15-2009 11:12 AM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) ShaqDiesel Linux - Server 1 09-11-2008 11:49 PM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) S canegames Debian 11 07-18-2007 12:57 PM
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) mohtasham1983 General 2 04-02-2007 06:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:46 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
Open Source Consulting | Domain Registration