| Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
05-16-2010, 05:54 PM
|
#1
|
|
Member
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684
Rep:
|
Why is mysql automatically logging me in without .my.cnf or my.cnf sections?
I've checked and double checked that there is no user and password directive in /etc/my.cnf and ~/.my.cnf but it seems that every time I issue mysql it will drop me into the command line without prompting for a password or giving any pause. Of course, the only table I have access to when doing this is information_schema with read only on most of it and no access on the rest, but I was just wondering where else an auto-login style authentication could be coming from.
Thanks in advance,
Alunduil
|
|
|
|
05-16-2010, 06:05 PM
|
#2
|
|
Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,861
Rep: 
|
Uh - maybe from not having defined a password for all users (most especially "root")?
Strong recommendation:
Quote:
mysql -uroot mysql
select User,Host,Password from user;
<= Create passwords, or delete, all users with "blank" passwords!
|
|
|
|
|
05-16-2010, 06:42 PM
|
#3
|
|
Member
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684
Original Poster
Rep:
|
All users have a password set and just for good measure I removed some users that I don't use any longer. Any other ideas?
Regards,
Alunduil
|
|
|
|
05-16-2010, 11:35 PM
|
#4
|
|
Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,861
Rep: 
|
A: Yes.
Please run this command, and cut/paste the results ("X" out any passwords from the post):
Quote:
mysql -uroot -pYOUR_ROOT_PASSWORD mysql
select User,Host,Password from user;
|
|
|
|
|
05-18-2010, 11:33 PM
|
#5
|
|
Member
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684
Original Poster
Rep:
|
Here you go. Sorry it took so long it's been a hectic week.
Code:
alunduil@giskard ~ $ mysql -uroot -p mysql
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1871
Server version: 5.0.90-log Gentoo Linux mysql-5.0.90-r2
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select User,Host,Password from user;
+-----------+-----------+-------------------------------------------+
| User | Host | Password |
+-----------+-----------+-------------------------------------------+
| root | localhost | *XXXXX |
| root | giskard | *XXXXX |
| snort | 127.0.0.1 | *XXXXX |
| snort | localhost | *XXXXX |
| wordpress | localhost | *XXXXX |
+-----------+-----------+-------------------------------------------+
5 rows in set (0.00 sec)
mysql>
Regards,
Alunduil
|
|
|
|
05-18-2010, 11:56 PM
|
#6
|
|
Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,861
Rep: 
|
Hi -
I'm confused
It looks like it *did* prompt you for a password (it says "Enter Password:").
Do you think maybe you somehow inadvertantly made "<Enter>" a valid password? What happens if you *change* the root password?
For whatever it's worth, here's how I usually go into the MySQL monitor:
Quote:
$ mysql -uroot -pROOT_PASSWORD mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1278
Server version: 5.0.77 Source distribution
|
Note that there's *no space* between "-u" and "root", or "-p" and the password.
'Hope that helps .. PSM
|
|
|
|
05-19-2010, 12:01 AM
|
#7
|
|
Member
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684
Original Poster
Rep:
|
Yes, but what I'm saying is as my user I'm able to issue the command: mysql (no options) and it will drop me at a prompt. That's the issue. When I specify a user and tell mysql (through the -p switch) to prompt me for the password of course it's going to.
I do understand the command you provided in your last post and the -uroot can have a space. You are able to pass -u root and mysql will parse it correctly. The same does not go for the password because if -p is found alone mysql prompts for the password (making it so shoulder surfers don't get what they are there for).
I was thinking it might be a stray .my.cnf that was getting pulled in from my environment but I don't see anything like that.
Regards,
Alunduil
|
|
|
|
05-19-2010, 12:37 AM
|
#8
|
|
Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,861
Rep: 
|
Hi -
Actually, my understanding of the "-p" options was primarily to allow you to enter it in-line (and prevent wasting time responding to some silly "Enter Password:" prompt).
Neither here nor there:
a) if you entered "-p" with a valid password, you should get in (without being challenged, and without seeing an "Enter Password" prompt).
b) I completely understand that your problem is that you don't seem to need a password in the first place (despite the fact that all users - including root - appear to have valid passwords).
I'm still suggesting that maybe the root password somehow got set to "\n". Couldn't hurt to change it...
You've absolutely confirmed that no MySql users have a null password - thank you.
And you're absolutely correct: now that we seem to have ruled out just about everything else, some ".my.cnf" file somewhere in the environment is just about the only thing left that makes any sense.
Q: have you tried all of the following commands:
Quote:
ls -la /root/.my.cnf
ls -la ~/.my.cnf
find / -name .my.cnf -print 2>/devnull
find / -name my.cnf -print 2>/devnull
|
Please keep us posted what you find - and good luck!
Last edited by paulsm4; 05-19-2010 at 12:39 AM.
|
|
|
|
05-19-2010, 03:07 AM
|
#9
|
|
Member
Registered: Jul 2006
Location: Belgium
Distribution: Debian, Fedora, CentOS, Windows
Posts: 352
Rep: 
|
Quote:
Originally Posted by alunduil
Yes, but what I'm saying is as my user I'm able to issue the command: mysql (no options) and it will drop me at a prompt. That's the issue. When I specify a user and tell mysql (through the -p switch) to prompt me for the password of course it's going to.
|
That's default behaviour. As you will see when you test it, you will not be able to see your databases, nor will you be able to make changes.
Edit: This will not be possible from any other system, then localhost.
Last edited by Blue_Ice; 05-19-2010 at 03:11 AM.
|
|
|
|
05-19-2010, 11:34 AM
|
#10
|
|
Member
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684
Original Poster
Rep:
|
Sorry about my earlier frustrations. It seems after removing the extra users that you pointed out from your first post and then finally restarting mysql provided the desired effect. If this issue surfaces again I hope to get a better answer.
Thanks for all the patience and help everyone.
Regards,
Alunduil
|
|
|
|
05-19-2010, 11:36 AM
|
#11
|
|
Member
Registered: Feb 2005
Location: San Antonio, TX
Distribution: Gentoo
Posts: 684
Original Poster
Rep:
|
Also, Blue_Ice, here's the default behaviour on two separate boxes:
Code:
alunduil@dornick ~ $ mysql
ERROR 1045 (28000): Access denied for user 'alunduil'@'localhost' (using password: NO)
Code:
alunduil@giskard ~ $ mysql
ERROR 1045 (28000): Access denied for user 'alunduil'@'localhost' (using password: NO)
Regards,
Alunduil
|
|
|
|
05-19-2010, 11:52 AM
|
#12
|
|
Member
Registered: Jul 2006
Location: Belgium
Distribution: Debian, Fedora, CentOS, Windows
Posts: 352
Rep: 
|
Quote:
Originally Posted by alunduil
Also, Blue_Ice, here's the default behaviour on two separate boxes:
Code:
alunduil@dornick ~ $ mysql
ERROR 1045 (28000): Access denied for user 'alunduil'@'localhost' (using password: NO)
Code:
alunduil@giskard ~ $ mysql
ERROR 1045 (28000): Access denied for user 'alunduil'@'localhost' (using password: NO)
Regards,
Alunduil
|
Sorry, forgot to mention that MySQL tries to use the linux user you logged in without password. I am not sure if MySQL tries to log in with an empty account if that doesn't work. Still default behavior as you can see in the response you get from the server.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 08:18 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|