473,498 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

newb probs w/ user accts

Newb here! Using 4.0.20 on Slack. Slogging through the official
manual. At 2.4.3 Securing the Initial MySQL Accounts, I'm finally
stopped cold while trying to follow instructions. Here's what I did:

shell> mysql -u root
mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');

.....as per instructed (I just cut 'n paste). I then quit mysql and
log back on as root:

mysql -u root

.....expecting a passwd prompt. Nothing. I just go in as root, as
confirmed by:

mysql> select user();
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+

So, about syntax, are all those single quotes suppose to be in the
actual command? Also, since I've done this (and nothing else), I can
no longer log in as anonymous. I get:

notbob ~>mysql
ERROR 1045: Access denied for user: 'notbob@localhost' (Using
password: NO)

Everything was going along so well. What happened?

nb
Jul 23 '05 #1
1 1539
notbob wrote:
mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');

....as per instructed (I just cut 'n paste). I then quit mysql and
log back on as root:

mysql -u root

....expecting a passwd prompt. Nothing.
You won't see a password prompt unless you also use the -p option. The
same username can be configured to log in using a password or without
using a password.

This is done so that you could, for example, configure a different set
of privileges for the same user, depending on whether they provide the
password, or log in without giving a password. You could even have the
same user log in with one of several passwords, and grant different
privileges depending on which password they use.

MySQL has great flexibility with their privilege system. So flexible
that it's probably very confusing to keep track of all the
configurations one might set up.
So, about syntax, are all those single quotes suppose to be in the
actual command?
Yes, they are.
notbob ~>mysql
ERROR 1045: Access denied for user: 'notbob@localhost' (Using
password: NO)


Again, you need to use the -p option to let mysql know that you are
attempting to log in using a password.

Without the -p option, you have told it to give you the privileges
granted to the anonymous login when no password is given. That's a
legitimate situation, since you might have deliberately granted a
special set of limited privileges in that case.
For example:
$ mysql -u root
mysql> grant all on test.* to ''@'localhost' identified by '';
mysql> quit;
$ mysql test
(no denial of connection, and no password prompt)

But since you changed the anonymous user's password to 'newpwd', and
didn't issue a specific grant to the anonymous user when not using a
password, this has effectively denied all access when you don't use a
password. No connection will work when not specifying a password.
That's probably what is desired, according to the MySQL setup
instructions -- to disable all non-passworded access, for all databases.

So try logging in thus:

mysql -p

Then type your newpwd at the prompt.

Regards,
Bill K.
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2340
by: Xizor | last post by:
Ok, I'm new to PHP and MySQL. I've been going through tutorials, reading the documentation, and looking through web sites. PHP to me seems great! With MySQL it seems even better. However, I'm an...
3
6526
by: Sean Berry | last post by:
Hi there. I am relativly new to Python CGI and need a question answered. I have made custom 404 error pages and have them in various web directories. I have not been able to figure out a way...
1
1961
by: Arijit Chatterjee | last post by:
Hi Everybody, I am facing another probs. I have created a trigger for table Tab1 for perticular column col1 for checking value ranges.But at time for using insert statement it is working fine but...
2
2260
by: jim | last post by:
I'm trying to find the best way to allow web visitors to download text files (.txt, .wri & .zap file extensions). I'm having some luck. I say some because the open/save box opens with IE but not...
12
4991
by: Mikejacko86 | last post by:
Hello everyone! I have decided to convert over my table-based layout to pure CSS, to reduce filesize and to increase my designs flexibility. Apparently, I have run into quite a few problems. I...
20
2003
by: Chad Everett | last post by:
Hi all, I am new to the group. Trying to learn Python programming on my own. I am working through Michael Dawson's Book Python Programming for the absolute beginner. I am tring to write a...
24
2317
by: Apotheosis | last post by:
The problem professor gave us is: Write a program which reads two integer values. If the first is less than the second, print the message "up". If the second is less than the first, print the...
3
1747
by: Mukesh | last post by:
HI all I have created a user ctrl for user info. On which i have used some asp ctrls, .net Ajax (Atlas) Ctrls and validation as described below Name TxtBox1(RequiedFieldValidator,...
8
2846
by: sabby | last post by:
I want to use the getline() so that i can enter a entire name in on line. (with spaces) The prob is that i am initializing the variable as "N/A" and saving it to a text file. it is declared as a...
0
7004
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7208
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6890
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4915
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4593
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3095
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1423
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
657
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
292
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.