Why does Grant command fail?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Guest's Avatar

    Why does Grant command fail?

    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


  • Gary Petersen

    #2
    Re: Why does Grant command fail?

    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 <3f5b3ff4_2@new s1.prserv.net> with its hoof:
    [color=blue]
    > 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[/color]

    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?

    Comment

    • Guest's Avatar

      #3
      Re: Why does Grant command fail?

      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" <garyp1492@remo ve.meearthlink. invalid> wrote in message
      news:pan.2003.0 9.07.20.51.33.8 47420.334@REMOV E.MEearthlink.I NVALID...[color=blue]
      > 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 <3f5b3ff4_2@new s1.prserv.net> with its hoof:
      >[color=green]
      > > 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[/color]
      >
      > 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?
      >[/color]


      Comment

      • Guest's Avatar

        #4
        Re: Why does Grant command fail?

        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@localho st identified as "newpw";

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

        <bruceaj@attglo bal.net> wrote in message news:3f5befb6_3 @news1.prserv.n et...[color=blue]
        > 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[/color]
        put[color=blue]
        > 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[/color]
        what[color=blue]
        > 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[/color]
        would[color=blue]
        > appreciate your comments.
        >
        > Thanks....
        >
        > Bruce
        >
        > "Gary Petersen" <garyp1492@remo ve.meearthlink. invalid> wrote in message
        > news:pan.2003.0 9.07.20.51.33.8 47420.334@REMOV E.MEearthlink.I NVALID...[color=green]
        > > 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 <3f5b3ff4_2@new s1.prserv.net> with its hoof:
        > >[color=darkred]
        > > > 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[/color][/color][/color]
        I[color=blue][color=green][color=darkred]
        > > > find out what the correct values should be?
        > > >
        > > > Thanks....
        > > >
        > > > Bruce A. Julseth[/color]
        > >
        > > 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?
        > >[/color]
        >
        >[/color]


        Comment

        • Gary Petersen

          #5
          Re: Why does Grant command fail?

          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 <3f5bf6a2_1@new s1.prserv.net> with its hoof:
          [color=blue]
          > 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@localho st identified as "newpw";
          >
          > and got the same error, ERROR 1045: Access denied for user"
          > '@localhost' (Using password: NO)
          >[/color]

          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.

          Comment

          • Mark Hewitt

            #6
            Re: Why does Grant command fail?

            <bruceaj@attglo bal.net> wrote in message news:3f5b3ff4_2 @news1.prserv.n et...[color=blue]
            > 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?[/color]

            Well, this is a concern:[color=blue][color=green]
            >> " '@localhost' (Using password: NO)[/color][/color]

            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'@'localho st' identified by 'mypw';

            That should work, I think??!!

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

            [color=blue]
            >
            > I am guessing that "myid" and/or "mypw" might be wrong. If so, how do I[/color]
            find[color=blue]
            > out what the correct values should be?
            >
            > Thanks....
            >
            > Bruce A. Julseth
            >
            >[/color]


            Comment

            • Gary Petersen

              #7
              Re: Why does Grant command fail?

              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 <3f5c8a5c$0$647 27@hades.is.co. za> with its hoof:
              [color=blue]
              > <bruceaj@attglo bal.net> wrote in message
              > news:3f5b3ff4_2 @news1.prserv.n et...[color=green]
              >> 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?[/color]
              >
              > Well, this is a concern:[color=green][color=darkred]
              >>> " '@localhost' (Using password: NO)[/color][/color]
              >
              > 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 ][/color]

              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.

              Comment

              • Bruce A. Julseth

                #8
                Re: Why does Grant command fail?

                Mark:

                Your suggestion worked.

                Bruce
                "Mark Hewitt" <corporate@scri ptsmiths.com> wrote in message
                news:3f5c8a5c$0 $64727@hades.is .co.za...[color=blue]
                > <bruceaj@attglo bal.net> wrote in message[/color]
                news:3f5b3ff4_2 @news1.prserv.n et...[color=blue][color=green]
                > > 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?[/color]
                >
                > Well, this is a concern:[color=green][color=darkred]
                > >> " '@localhost' (Using password: NO)[/color][/color]
                >
                > 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'@'localho st' identified by 'mypw';
                >
                > That should work, I think??!!
                >
                > HTH,
                > Mark
                > --------------------------------------------------------------------------[/color]
                -[color=blue]
                > Windows, Linux and Internet Development Consultant
                > Email: corporate@scrip tsmiths.com
                > Web: http://www.scriptsmiths.com
                > --------------------------------------------------------------------------[/color]
                -[color=blue]
                >
                >[color=green]
                > >
                > > I am guessing that "myid" and/or "mypw" might be wrong. If so, how do I[/color]
                > find[color=green]
                > > out what the correct values should be?
                > >
                > > Thanks....
                > >
                > > Bruce A. Julseth
                > >
                > >[/color]
                >
                >[/color]


                Comment

                • Bruce A. Julseth

                  #9
                  Re: Why does Grant command fail?

                  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" <garyp1492@remo ve.meearthlink. invalid> wrote in message
                  news:pan.2003.0 9.09.02.20.23.5 59607.489@REMOV E.MEearthlink.I NVALID...[color=blue]
                  > 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 <3f5c8a5c$0$647 27@hades.is.co. za> with its hoof:
                  >[color=green]
                  > > <bruceaj@attglo bal.net> wrote in message
                  > > news:3f5b3ff4_2 @news1.prserv.n et...[color=darkred]
                  > >> 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?[/color]
                  > >
                  > > Well, this is a concern:[color=darkred]
                  > >>> " '@localhost' (Using password: NO)[/color]
                  > >
                  > > 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 ][/color]
                  >
                  > 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.
                  >[/color]


                  Comment

                  • Gary Petersen

                    #10
                    Re: Why does Grant command fail?

                    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 <3f5d9caa_3@new s1.prserv.net> with its hoof:
                    [color=blue]
                    > [...]
                    > As for "learning" mysql priviledge system, where can I get
                    > documentation? Can you recommend a good book on the subject?
                    >[/color]

                    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.

                    Comment

                    • Bruce A. Julseth

                      #11
                      Re: Why does Grant command fail?

                      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" <garyp1492@remo ve.meearthlink. invalid> wrote in message
                      news:pan.2003.0 9.09.15.23.10.6 77146.336@REMOV E.MEearthlink.I NVALID...[color=blue]
                      > 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 <3f5d9caa_3@new s1.prserv.net> with its hoof:
                      >[color=green]
                      > > [...]
                      > > As for "learning" mysql priviledge system, where can I get
                      > > documentation? Can you recommend a good book on the subject?
                      > >[/color]
                      >
                      > 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.
                      >[/color]


                      Comment

                      • lawrence

                        #12
                        Re: Why does Grant command fail?

                        "Bruce A. Julseth" <bruceaj@attglo bal.net> wrote in message[color=blue]
                        >Our local Barnes and Noble is pretty light on
                        >computer books, but I will try them.[/color]

                        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.

                        Comment

                        • Bruce A. Julseth

                          #13
                          Re: Why does Grant command fail?

                          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" <lkrubner@geoci ties.com> wrote in message
                          news:da7e68e8.0 309091406.2982c 342@posting.goo gle.com...[color=blue]
                          > "Bruce A. Julseth" <bruceaj@attglo bal.net> wrote in message[color=green]
                          > >Our local Barnes and Noble is pretty light on
                          > >computer books, but I will try them.[/color]
                          >
                          > 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.[/color]


                          Comment

                          Working...