SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    London
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    create database problem (and almost solution!)

    hi guys, thanks for the help with my last query.

    I'm sort of up and running now with mySQL on WinXP. While I can do lots with mySQL I seem unable to create a new database so I'm currently stuck with the test one.

    I get an: Error 1044: Access denied for user: '@localhost' to database...

    when I try and create a new db. I think (thorugh some fishing about) that its because I have not set a password on mySQL root (what is root by the way).

    I tried to do this but failed. is there an easy way to do this or get round this problem. I'm working off localhost

    thanks so much

    JP

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When you log in do you actully log in as root?
    mysql -u root
    and just
    mysql
    are different. The latter logs you in as an anymous user that may have privileges to log in but not create tables etc.

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    London
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey i think i log in as just mySQL

    i use a php program and it logs in as such:

    $host="localhost";
    $user="";
    $password="";

    how do i log in as root via this way or another way?

    Thanks again - ill be glad to sort this out so i can do something!!

    JP

  4. #4
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you doing this on your own machine? I would guess so, but if not logging on as any user or root without a password isn't very secure.

    Look up in the manual how to GRANT a user privileges in the database including setting a password for them. Then use a user you specifically set up with the user and password you gave them when you are testing from a PHP application.

    For some reason the default in mysql setup is to allow any user to connect from anywhere without a password.

  5. #5
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    London
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks so much dave

    i am using my machine. I went to the sql manual and tried to follow info fromt his page:
    http://dev.mysql.com/doc/mysql/en/adding-users.html

    but got this error message? I'm not sure what to do now...

    mysql> --user=root mysql
    mysql> grant all privileges on *.* to 'myname'@'localhost'
    -> identified by 'mypassword' with grant option;
    ERROR 1045: Access denied for user: '@localhost' (Using password: NO)

  6. #6
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    London
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyone got any idea? its a nightmare not being able to create a database but everything i try doesnt work!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •