By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,830 Members | 2,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,830 IT Pros & Developers. It's quick & easy.

Why does Grant command fail?

P: n/a
I issued the mysql command

Grant all on *.* to myid@localhost identified as "mypw";

and recieved the error message

ERROR 1045: Access denied for user" '@localhost' (Using password: NO)

I am running mysql on my own machine which is not networked.

What am I doing wrong and how do I fix it?

I am guessing that "myid" and/or "mypw" might be wrong. If so, how do I find
out what the correct values should be?

Thanks....

Bruce A. Julseth
Jul 16 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
A horsie named bruceaj demonstrated surprising intellligence and its
ability to use morse code on Sun, 07 Sep 2003 09:22:25 -0500 when it
tapped <3f********@news1.prserv.net> with its hoof:
I issued the mysql command

Grant all on *.* to myid@localhost identified as "mypw";

and recieved the error message

ERROR 1045: Access denied for user" '@localhost' (Using password: NO)

I am running mysql on my own machine which is not networked.

What am I doing wrong and how do I fix it?

I am guessing that "myid" and/or "mypw" might be wrong. If so, how do I
find out what the correct values should be?

Thanks....

Bruce A. Julseth


You can only grant privileges that you have, and since you
logged in anonymously, you are running as a user with almost
no privileges. Log-in as a more privileged user first. Only
grant priviledges that you want that user-name to have.

Do you really want this user-name to have DROP and SHUTDOWN
privileges?

Jul 16 '05 #2

P: n/a
I'm the only user of this machine. My user name, on my XP startup page, is
my name and I use NO password. This id has admin privileges.

Is this the user you are discussing in your reply? If so, would

Grant all on *.* to 'my name'@localhost identified as ???? What do I put
here since I don't use a password?

work. I tried it and, guess what? It didn't work. So I still don't know what
I'm doing!!

Since I have XP admin privileges, will I have to create a user id with a
password?

I'm going to try that approach but, on the assumption it won't work, I would
appreciate your comments.

Thanks....

Bruce

"Gary Petersen" <ga*******@remove.meearthlink.invalid> wrote in message
news:pa********************************@REMOVE.MEe arthlink.INVALID...
A horsie named bruceaj demonstrated surprising intellligence and its
ability to use morse code on Sun, 07 Sep 2003 09:22:25 -0500 when it
tapped <3f********@news1.prserv.net> with its hoof:
I issued the mysql command

Grant all on *.* to myid@localhost identified as "mypw";

and recieved the error message

ERROR 1045: Access denied for user" '@localhost' (Using password: NO)

I am running mysql on my own machine which is not networked.

What am I doing wrong and how do I fix it?

I am guessing that "myid" and/or "mypw" might be wrong. If so, how do I
find out what the correct values should be?

Thanks....

Bruce A. Julseth


You can only grant privileges that you have, and since you
logged in anonymously, you are running as a user with almost
no privileges. Log-in as a more privileged user first. Only
grant priviledges that you want that user-name to have.

Do you really want this user-name to have DROP and SHUTDOWN
privileges?

Jul 16 '05 #3

P: n/a
Okay. I created a new user with a password on my XP machine and issued the
following command under mysql,

Grant all on *.* to newuser@localhost identified as "newpw";

and got the same error, ERROR 1045: Access denied for user" '@localhost'
(Using password: NO)

<br*****@attglobal.net> wrote in message news:3f********@news1.prserv.net...
I'm the only user of this machine. My user name, on my XP startup page, is
my name and I use NO password. This id has admin privileges.

Is this the user you are discussing in your reply? If so, would

Grant all on *.* to 'my name'@localhost identified as ???? What do I put here since I don't use a password?

work. I tried it and, guess what? It didn't work. So I still don't know what I'm doing!!

Since I have XP admin privileges, will I have to create a user id with a
password?

I'm going to try that approach but, on the assumption it won't work, I would appreciate your comments.

Thanks....

Bruce

"Gary Petersen" <ga*******@remove.meearthlink.invalid> wrote in message
news:pa********************************@REMOVE.MEe arthlink.INVALID...
A horsie named bruceaj demonstrated surprising intellligence and its
ability to use morse code on Sun, 07 Sep 2003 09:22:25 -0500 when it
tapped <3f********@news1.prserv.net> with its hoof:
I issued the mysql command

Grant all on *.* to myid@localhost identified as "mypw";

and recieved the error message

ERROR 1045: Access denied for user" '@localhost' (Using password: NO)

I am running mysql on my own machine which is not networked.

What am I doing wrong and how do I fix it?

I am guessing that "myid" and/or "mypw" might be wrong. If so, how do I find out what the correct values should be?

Thanks....

Bruce A. Julseth


You can only grant privileges that you have, and since you
logged in anonymously, you are running as a user with almost
no privileges. Log-in as a more privileged user first. Only
grant priviledges that you want that user-name to have.

Do you really want this user-name to have DROP and SHUTDOWN
privileges?


Jul 16 '05 #4

P: n/a
A horsie named bruceaj demonstrated surprising intellligence and its
ability to use morse code on Sun, 07 Sep 2003 22:21:44 -0500 when it
tapped <3f********@news1.prserv.net> with its hoof:
Okay. I created a new user with a password on my XP machine and issued
the following command under mysql,

Grant all on *.* to newuser@localhost identified as "newpw";

and got the same error, ERROR 1045: Access denied for user"
'@localhost' (Using password: NO)


I don't use WinXP, but I'm assuming that the situation
is similar to my Slackware Linux machine.

The operating system's list of users is completely
separate from mysql's list of users. The fact that
you logged in to XP as an administrator does not
carry over to mysql. You would have to log into
mysql's administrator account(s) to create new users.
On my Slackware system, the only such account is
called "root"; this root account is completely separate
from the OS root account.

Read up on the GRANT command in the mysql manual, and
also read the section on privileges.

You probably want to create a user for php. You probably
do *not* want that user to have all powers. You probably
do *not* want that user to have access to all databases.

The grant command you gave above would give "newuser" all
rights to all databases. And so if someone compromised
the "newuser" account, they could change the passwords
of all accounts and lock you out of your db server. They
could also SHUTDOWN the server.

Instead, create the database and its tables under the
root user; then create a "newuser" with limited rights
*only* to that database.

Jul 16 '05 #5

P: n/a
<br*****@attglobal.net> wrote in message news:3f********@news1.prserv.net...
I issued the mysql command

Grant all on *.* to myid@localhost identified as "mypw";

and recieved the error message

ERROR 1045: Access denied for user" '@localhost' (Using password: NO)

I am running mysql on my own machine which is not networked.

What am I doing wrong and how do I fix it?
Well, this is a concern:
" '@localhost' (Using password: NO)


Why no user name? Perhaps you logged in as the anonymous user? I'd pretty
sure this user
cannot grant privileges, (he does now have a "with grant option" on his
account).

Did you log in to your server as root?
If this is a brand new installation without any changes (i..e you have not
yet assigned a
to root), try:

c:\whatever> mysql -u root -p
[hit enter to bypass password entry[
mysql> <--- should get a mysql prompt

Now try your grant:
mysql > Grant all on *.* to 'myid'@'localhost' identified by 'mypw';

That should work, I think??!!

HTH,
Mark
---------------------------------------------------------------------------
Windows, Linux and Internet Development Consultant
Email: co*******@scriptsmiths.com
Web: http://www.scriptsmiths.com
---------------------------------------------------------------------------


I am guessing that "myid" and/or "mypw" might be wrong. If so, how do I find out what the correct values should be?

Thanks....

Bruce A. Julseth

Jul 16 '05 #6

P: n/a
A horsie named Mark Hewitt demonstrated surprising intellligence and its
ability to use morse code on Mon, 08 Sep 2003 08:59:02 -0500 when it
tapped <3f**************@hades.is.co.za> with its hoof:
<br*****@attglobal.net> wrote in message
news:3f********@news1.prserv.net...
I issued the mysql command

Grant all on *.* to myid@localhost identified as "mypw";

and recieved the error message

ERROR 1045: Access denied for user" '@localhost' (Using password: NO)

I am running mysql on my own machine which is not networked.

What am I doing wrong and how do I fix it?


Well, this is a concern:
" '@localhost' (Using password: NO)


Why no user name? Perhaps you logged in as the anonymous user? I'd
pretty sure this user
cannot grant privileges, (he does now have a "with grant option" on his
account).

Did you log in to your server as root? If this is a brand new
installation without any changes (i..e you have not yet assigned a
to root), try:

[ creating a new mysql user with rights equal to root
(UNSAFE) snipped ]


bruceaj, don't do it. If you don't have time to read up
on the mysql priviledge system, just continue to log-in
anonymously and use the "test" database.

Using the test database allows you to play around with
creating and deleting tables and making queries without
all of fuss of creating a new user.

Jul 16 '05 #7

P: n/a
Mark:

Your suggestion worked.

Bruce
"Mark Hewitt" <co*******@scriptsmiths.com> wrote in message
news:3f**************@hades.is.co.za...
<br*****@attglobal.net> wrote in message news:3f********@news1.prserv.net...
I issued the mysql command

Grant all on *.* to myid@localhost identified as "mypw";

and recieved the error message

ERROR 1045: Access denied for user" '@localhost' (Using password: NO)

I am running mysql on my own machine which is not networked.

What am I doing wrong and how do I fix it?


Well, this is a concern:
" '@localhost' (Using password: NO)


Why no user name? Perhaps you logged in as the anonymous user? I'd pretty
sure this user
cannot grant privileges, (he does now have a "with grant option" on his
account).

Did you log in to your server as root?
If this is a brand new installation without any changes (i..e you have not
yet assigned a
to root), try:

c:\whatever> mysql -u root -p
[hit enter to bypass password entry[
mysql> <--- should get a mysql prompt

Now try your grant:
mysql > Grant all on *.* to 'myid'@'localhost' identified by 'mypw';

That should work, I think??!!

HTH,
Mark
--------------------------------------------------------------------------

- Windows, Linux and Internet Development Consultant
Email: co*******@scriptsmiths.com
Web: http://www.scriptsmiths.com
-------------------------------------------------------------------------- -

I am guessing that "myid" and/or "mypw" might be wrong. If so, how do I

find
out what the correct values should be?

Thanks....

Bruce A. Julseth


Jul 16 '05 #8

P: n/a
Gary:

I already have implemented Mark's suggestion.

As for sucurity, I wouldn't think this would be problem, in this case,
becasue I'm on a stand along machine that ONLY I use. Your idea of using the
test database should have worked,

As for "learning" mysql priviledge system, where can I get documentation?
Can you recommend a good book on the subject?

Thanks....

Bruce

"Gary Petersen" <ga*******@remove.meearthlink.invalid> wrote in message
news:pa********************************@REMOVE.MEe arthlink.INVALID...
A horsie named Mark Hewitt demonstrated surprising intellligence and its
ability to use morse code on Mon, 08 Sep 2003 08:59:02 -0500 when it
tapped <3f**************@hades.is.co.za> with its hoof:
<br*****@attglobal.net> wrote in message
news:3f********@news1.prserv.net...
I issued the mysql command

Grant all on *.* to myid@localhost identified as "mypw";

and recieved the error message

ERROR 1045: Access denied for user" '@localhost' (Using password: NO)

I am running mysql on my own machine which is not networked.

What am I doing wrong and how do I fix it?


Well, this is a concern:
" '@localhost' (Using password: NO)


Why no user name? Perhaps you logged in as the anonymous user? I'd
pretty sure this user
cannot grant privileges, (he does now have a "with grant option" on his
account).

Did you log in to your server as root? If this is a brand new
installation without any changes (i..e you have not yet assigned a
to root), try:

[ creating a new mysql user with rights equal to root
(UNSAFE) snipped ]


bruceaj, don't do it. If you don't have time to read up
on the mysql priviledge system, just continue to log-in
anonymously and use the "test" database.

Using the test database allows you to play around with
creating and deleting tables and making queries without
all of fuss of creating a new user.

Jul 16 '05 #9

P: n/a
A horsie named Bruce A. Julseth demonstrated surprising intelligence and
its ability to use morse code on Tue, 09 Sep 2003 04:22:35 -0500 when it
tapped <3f********@news1.prserv.net> with its hoof:
[...]
As for "learning" mysql priviledge system, where can I get
documentation? Can you recommend a good book on the subject?


An electronic copy of the mysql manual was included on
my Slackware Linux CDs. Even though you are still using
Windows, you could get a CD and copy the manual (which
is in HTML format) from it.

In addition to using the installed mysql manual on my
system, I also used google to find some mysql tutorials
on the 'Net which proved to be very educational.

I didn't use any books, but I would advice you to get
one because learning from various documents strewn
all over the place is difficult compared to having
a consolidated, printed resource. Check Amazon.

Jul 16 '05 #10

P: n/a
I can probably download a manual from the MySQL site. Thanks. As for a book,
I was hoping someone could suggest a good learning book. From Amazon, I have
to go by the "Sales Pitch" they put together. Our local Barnes and Noble is
pretty light on computer books, but I will try them.

Maybe some out there in PHP/MySQL can suggest a good book for learning
MySQL.

Thanks for the response.

Bruce

"Gary Petersen" <ga*******@remove.meearthlink.invalid> wrote in message
news:pa********************************@REMOVE.MEe arthlink.INVALID...
A horsie named Bruce A. Julseth demonstrated surprising intelligence and
its ability to use morse code on Tue, 09 Sep 2003 04:22:35 -0500 when it
tapped <3f********@news1.prserv.net> with its hoof:
[...]
As for "learning" mysql priviledge system, where can I get
documentation? Can you recommend a good book on the subject?


An electronic copy of the mysql manual was included on
my Slackware Linux CDs. Even though you are still using
Windows, you could get a CD and copy the manual (which
is in HTML format) from it.

In addition to using the installed mysql manual on my
system, I also used google to find some mysql tutorials
on the 'Net which proved to be very educational.

I didn't use any books, but I would advice you to get
one because learning from various documents strewn
all over the place is difficult compared to having
a consolidated, printed resource. Check Amazon.

Jul 16 '05 #11

P: n/a
"Bruce A. Julseth" <br*****@attglobal.net> wrote in message
Our local Barnes and Noble is pretty light on
computer books, but I will try them.


What is the world coming to? A Barnes and Noble that's light on
computer books? That's like a Starbucks without too much cream, or a
webdesigner without a personal webpage.
Jul 16 '05 #12

P: n/a
My sentiments exactly...

I did find and bought
PHP and MySQL Web Development, Second Edition [Paperback]
By: Luke Welling (Author), Laura Thomson (Author)

It looked good to me. Hope it is...

Bruce

"lawrence" <lk******@geocities.com> wrote in message
news:da**************************@posting.google.c om...
"Bruce A. Julseth" <br*****@attglobal.net> wrote in message
Our local Barnes and Noble is pretty light on
computer books, but I will try them.


What is the world coming to? A Barnes and Noble that's light on
computer books? That's like a Starbucks without too much cream, or a
webdesigner without a personal webpage.

Jul 16 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.