Results 1 to 6 of 6
  1. #1
    Join Date
    May 2004
    Posts
    2

    Unanswered: Trouble Connecting to MySQL

    So, I just got a new computer (excellent), but I cannot connect to MySQL via my PHP pages.

    Running Windows XP Pro, I've installed IIS and MySQL 4. I can connect to the database from the Command line, and PHPMyAdmin works fine. But when I try to run this code from PHP:

    PHP Code:
    $link mysql_connect('localhost''gareth''[password]') or die("Could not connect");
    mysql_select_db('test'); 
    I get this result:

    Warning: mysql_connect(): Access denied for user: 'gareth@localhost' (Using password: YES) in c:\inetpub\wwwroot\tbrooks\TMP2j9oqxq230.php on line 7
    Could not connect

    I've checked everything. Running WinMySQLAdmin, I can see that I have the user and password right. Can anyone offer any suggestions?

  2. #2
    Join Date
    Sep 2003
    Posts
    24
    Dude, what is this?!? IIS can run PHP?!?

    If so, this changes everything!

    I don't know a fix for your problem, by the way. Sorry.

  3. #3
    Join Date
    Mar 2004
    Posts
    480
    Have you tried password without the square brackets?
    Does the user gareth have permissions to access the database?

  4. #4
    Join Date
    May 2004
    Location
    Northern California
    Posts
    10
    looks like you didn't grant your user the proper privileges to access the db
    Tuan M. -- Database Developer Newbie, dot NET generation
    If you want cheap-shit web hosting, check out www.websaic.com
    For all your custom test socket needs, check out Gold Technologies, Inc.
    Oh yeah, last but not least, GO BAR-Honda!

  5. #5
    Join Date
    May 2004
    Location
    Northern California
    Posts
    10
    whoop, guelphdad got there first hehe.
    Tuan M. -- Database Developer Newbie, dot NET generation
    If you want cheap-shit web hosting, check out www.websaic.com
    For all your custom test socket needs, check out Gold Technologies, Inc.
    Oh yeah, last but not least, GO BAR-Honda!

  6. #6
    Join Date
    May 2004
    Posts
    2
    That's just it. Gareth *is* the user who's been set up. When I run winmysqladmin, gareth is identified as the user.

Posting Permissions

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