Professional Web Applications Themes

mysql allows blank username and password - PHP Development

Hi, I'm a bit of a newbie to PHP and mySQL. I'm trying to get things running on my W2K machine. I'm having a problem using the mysql_connect() function (although the problem's probably rooted in mysql). When trying to log in via PHP with the code "$link = mysql_connect("localhost", "phil", "pwpass123");" I get the error... Warning: mysql_connect() [function.mysql-connect]: Access denied for user: 'phillocalhost' (Using password: YES) in c:\inetpub\wwwroot\php\mysql.php on line 9 The thing is that it connects ok if I leave the username and password blank. The ones I'm using above are ones I specified in mysqladmin when I first ...

  1. #1

    Default mysql allows blank username and password

    Hi, I'm a bit of a newbie to PHP and mySQL. I'm trying to get things running
    on my W2K machine.

    I'm having a problem using the mysql_connect() function (although the
    problem's probably rooted in mysql). When trying to log in via PHP with the
    code "$link = mysql_connect("localhost", "phil", "pwpass123");" I get the
    error...

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user:
    'phillocalhost' (Using password: YES) in c:\inetpub\wwwroot\php\mysql.php
    on line 9

    The thing is that it connects ok if I leave the username and password blank.
    The ones I'm using above are ones I specified in mysqladmin when I first ran
    it.

    Can anyone help me 1) Stop mysql accepting blank username and password
    values, and 2) get it to accept my defined username and password?

    Many thanks in advance,
    Phil


    Phil W Guest

  2. #2

    Default Re: mysql allows blank username and password

    I would hazard a guess that you haven't granted phil the right permissions.

    mysql -- user=root mysql
    GRANT ALL PRIVEILEGES ON *.* TO userlocalhost IDENTIFIED BY 'password' WITH
    GRANT OPTION;

    I would also guess that root (which is the default) doesn't have a password
    set up which is why that works.

    HTH.
    PWT.



    "Phil W" <meprivacy.net> wrote in message
    news:bj9qct$gth67$1ID-180242.news.uni-berlin.de...
    > Hi, I'm a bit of a newbie to PHP and mySQL. I'm trying to get things
    running
    > on my W2K machine.
    >
    > I'm having a problem using the mysql_connect() function (although the
    > problem's probably rooted in mysql). When trying to log in via PHP with
    the
    > code "$link = mysql_connect("localhost", "phil", "pwpass123");" I get the
    > error...
    >
    > Warning: mysql_connect() [function.mysql-connect]: Access denied for user:
    > 'phillocalhost' (Using password: YES) in c:\inetpub\wwwroot\php\mysql.php
    > on line 9
    >
    > The thing is that it connects ok if I leave the username and password
    blank.
    > The ones I'm using above are ones I specified in mysqladmin when I first
    ran
    > it.
    >
    > Can anyone help me 1) Stop mysql accepting blank username and password
    > values, and 2) get it to accept my defined username and password?
    >
    > Many thanks in advance,
    > Phil
    >
    >

    Peter Taurins Guest

  3. #3

    Default Re: mysql allows blank username and password

    "Gary Petersen" <garyp1492remove.meearthlink.invalid> wrote in message
    news:pan.2003.09.07.05.42.01.186772.260REMOVE.MEe arthlink.INVALID...
    > Delete the "test" database and make sure that the
    > "root" user (in mysql) has a password.
    >
    > By default, anonymous users have access to databases
    > that start with "test" (I think).
    >
    > For your login problem, perhaps you are using the wrong
    > password. See if you can change it with mysqladmin.
    Cheers Gary, I ended up going back to square one and doing just that.

    Also, I think I was getting mixed up with the winmysqladmin - the username
    password defined there seems to just get dropped into the my.ini file for
    login, whereas I originally thought it was setting that user up too. I could
    well be wrong about that though! I think I need to get one of those "for
    dummies" books on mysql!


    Phil W Guest

Similar Threads

  1. username and password
    By ahamma in forum Macromedia Contribute Connection Administrtion
    Replies: 1
    Last Post: April 4th, 06:34 AM
  2. username and password verification
    By pat luton in forum Dreamweaver AppDev
    Replies: 2
    Last Post: April 1st, 06:39 PM
  3. password/username
    By btforres in forum Dreamweaver AppDev
    Replies: 4
    Last Post: March 30th, 12:03 AM
  4. Username, Password, Pin
    By djmasala.com in forum Macromedia Director Basics
    Replies: 0
    Last Post: November 7th, 01:04 AM
  5. Username and password?
    By northerncaller webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 0
    Last Post: July 9th, 10:51 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139