Arghhh mysql help

ClutchClutch North Carolina New
edited July 2003 in Internet & Media
I'm trying to set up mysql on my computer to start learning php, but I can't set the root password. I have typed all the commands in to set it but when I go to type in the password I set I get this


C:\>c:\mysql\bin\mysqladmin -u root -p greencow
Enter password: ********
c:\mysql\bin\mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@127.0.0.1' (Using password: YES)'

Comments

  • ShortyShorty Manchester, UK Icrontian
    edited June 2003
    Did you originally setup a password for root??

    If not..

    Type..

    mysql -uroot

    It should let you straight into MySQL..

    then type :

    set password for root@localhost = password ('greencow');

    :)
  • ClutchClutch North Carolina New
    edited June 2003
    I tried that short but now it gives me this

    C:\>c:\mysql\bin\mysqladmin -u root -p redhorse
    Enter password: ********
    c:\mysql\bin\mysqladmin: connect to server at 'localhost' failed
    error: 'Access denied for user: 'root@127.0.0.1' (Using password: YES)'

    at first when I installed mysql I got rid of the annonymous account then typed in

    c:\mysql\bin\mysqladmin -u root password my_password
    c:\mysql\bin\mysqladmin -u root -h localhost password my_password

    to set up the root account with a password

    but I get the same error message over and over
  • ShortyShorty Manchester, UK Icrontian
    edited June 2003
    Go into C:/mysql/bin .. and look for a file called Winmysqladmin

    Open it and it will move to the system tray. Open it and edit the my.ini file... to reflect the change. Alternatively.. look in the C:/windows directory for the file and edit it in notepad/wordpad.

    A useful tip after you have done this.. reboot the machine and then... when you need to access mysql.. use the -p flag.. but without putting in your password.. so it looks like this..

    mysql -uroot -p

    It will then ask you for the password :)

    Here is how I setup MySQL... for future reference..

    1) Install MySQL
    2) Open a DOS window and navigate to C:/mysql/bin
    3) Type : mysql -uroot
    4) The prompt will change to say mysql>
    5) Type set password for root@localhost = password ('password');
    6) Exit

    Then when you create your db's.. do this..

    1) Dos window... and navigate to c:/mysql/bin
    2) Type mysql -uroot -p
    3) enter password
    4) At mysql> prompt type : create database new;
    5) Grant all priveleges on new.* to newuser@localhost;
    6) set password for newuser@localhost = password ('password');
    7) Exit

    That creates a db called "new" (or whatever you would prefer).. creates a user with all privileges called "newuser" who can only access the "new" db. It also sets a password.

    Edit... btw.. the ('password') is what you want it to be.. eg... ('clutch') or ('sqlisgreatbutconfusing')

    This whole process enables a recommended security tip. Avoid using root as a default user as much as possible :)
  • ClutchClutch North Carolina New
    edited June 2003
    Thanks for the help shorty, you are the man no doubt. I'm going to un-install mysql and try to install it agian to see if I can get it to work. I'll report back in later.
  • ShortyShorty Manchester, UK Icrontian
    edited June 2003
    Here if ya need.. I've walked a few peeps through it in recent weeks following my learning when we were just putting Short-media together :)
  • a2jfreaka2jfreak Houston, TX Member
    edited July 2003
    Too bad I've never found a Windows Installer for PostrgreSQL. I'd love to try that out. The only computer I have Linux on is my laptop and that old thing ain't gonna be booted up unless I'm desparately seeking toture.

    K62-333 w/ 64MB of RAM.
    It's super slow!
Sign In or Register to comment.