Professional Web Applications Themes

Cant connect with -hlocalhost - MySQL

Hi All Apologies for a seriously newbie quesion, but I've been doing so many installations and all have the same problem. When i try to connect using mysql command line: mysql --user=cde --password=cde --database=CDE --host=192.168.10.52 It works fine. However, when I try to use localhost as the host name I receive an error: mysql --user=cde --password=cde --database=CDE --host=localhost The user I have created is cde% - surely this should catch all hosts? I've also tried creating a cdelocalhost user, no luck. I dont want to hardcode the IP address in my code, so PLEASE help. Thanks in advance! Hein...

  1. #1

    Default Cant connect with -hlocalhost

    Hi All

    Apologies for a seriously newbie quesion, but I've been doing so many
    installations and all have the same problem.

    When i try to connect using mysql command line:

    mysql --user=cde --password=cde --database=CDE --host=192.168.10.52

    It works fine.

    However, when I try to use localhost as the host name I receive an
    error:

    mysql --user=cde --password=cde --database=CDE --host=localhost

    The user I have created is cde% - surely this should catch all hosts?

    I've also tried creating a cdelocalhost user, no luck.

    I dont want to hardcode the IP address in my code, so PLEASE help.

    Thanks in advance!
    Hein

    Hein Guest

  2. #2

    Default Re: Cant connect with -hlocalhost

    Hein wrote:
    > Hi All
    >
    > Apologies for a seriously newbie quesion, but I've been doing so many
    > installations and all have the same problem.
    >
    > When i try to connect using mysql command line:
    >
    > mysql --user=cde --password=cde --database=CDE --host=192.168.10.52
    >
    > It works fine.
    >
    > However, when I try to use localhost as the host name I receive an
    > error:
    >
    > mysql --user=cde --password=cde --database=CDE --host=localhost
    >
    > The user I have created is cde% - surely this should catch all hosts?
    >
    > I've also tried creating a cdelocalhost user, no luck.
    >
    > I dont want to hardcode the IP address in my code, so PLEASE help.
    >
    > Thanks in advance!
    > Hein
    >
    Which error are you receiving?
    If it says that your user is not authorized, probably you still have anonymous users in your database.
    You should remove them, either manually as described in this page:
    [url]http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html[/url]
    or using the mysql_secure_installation script which is provided with recent MySQL packages.

    The reason for this conflict is that anonymous users with no password are evaluated before users with passwords
    ([url]http://dev.mysql.com/doc/refman/5.1/en/connection-access.html[/url]).

    Remove the anonymous users, flush the grant privileges, and try again.

    ciao
    gmax

    --
    _ _ _ _
    (_|| | |(_|>< The Data Charmer
    _|
    [url]http://datacharmer.org/[/url]
    Giuseppe Maxia Guest

  3. #3

    Default Re: Cant connect with -hlocalhost

    Awesome thanks a million Giuseppe!!

    Why is it always a mission in to get the basics working with these
    linux goodies.

    Thanks again mate.


    Giuseppe Maxia wrote:
    > Hein wrote:
    > > Hi All
    > >
    > > Apologies for a seriously newbie quesion, but I've been doing so many
    > > installations and all have the same problem.
    > >
    > > When i try to connect using mysql command line:
    > >
    > > mysql --user=cde --password=cde --database=CDE --host=192.168.10.52
    > >
    > > It works fine.
    > >
    > > However, when I try to use localhost as the host name I receive an
    > > error:
    > >
    > > mysql --user=cde --password=cde --database=CDE --host=localhost
    > >
    > > The user I have created is cde% - surely this should catch all hosts?
    > >
    > > I've also tried creating a cdelocalhost user, no luck.
    > >
    > > I dont want to hardcode the IP address in my code, so PLEASE help.
    > >
    > > Thanks in advance!
    > > Hein
    > >
    >
    > Which error are you receiving?
    > If it says that your user is not authorized, probably you still have anonymous users in your database.
    > You should remove them, either manually as described in this page:
    > [url]http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html[/url]
    > or using the mysql_secure_installation script which is provided with recent MySQL packages.
    >
    > The reason for this conflict is that anonymous users with no password are evaluated before users with passwords
    > ([url]http://dev.mysql.com/doc/refman/5.1/en/connection-access.html[/url]).
    >
    > Remove the anonymous users, flush the grant privileges, and try again.
    >
    > ciao
    > gmax
    >
    > --
    > _ _ _ _
    > (_|| | |(_|>< The Data Charmer
    > _|
    > [url]http://datacharmer.org/[/url]
    Hein Guest

  4. #4

    Default Re: Cant connect with -hlocalhost

    Hein wrote:
    > Hi All
    >
    > Apologies for a seriously newbie quesion, but I've been doing so many
    > installations and all have the same problem.
    >
    > When i try to connect using mysql command line:
    >
    > mysql --user=cde --password=cde --database=CDE --host=192.168.10.52
    >
    > It works fine.
    >
    > However, when I try to use localhost as the host name I receive an
    > error:
    >
    > mysql --user=cde --password=cde --database=CDE --host=localhost
    >
    > The user I have created is cde% - surely this should catch all hosts?
    >
    > I've also tried creating a cdelocalhost user, no luck.
    >
    > I dont want to hardcode the IP address in my code, so PLEASE help.
    >
    > Thanks in advance!
    > Hein
    >

    Hein, In addition to what Giuseppe said - are you installing this on
    Windows or Unix/Linux? For instance, 'localhost' is handled differently
    on Linux, for instance - MySQL uses a socket instead of tcpip.

    And yes, the error message you're getting is critical to diagnosing the
    problem.

    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    [email]jstucklexattglobal.net[/email]
    ==================
    Jerry Stuckle Guest

  5. #5

    Default Re: Cant connect with -hlocalhost

    Hi Jerry

    On Linux, apologies, I thought I gave the error:

    ERROR 1045 (28000): Access denied for user 'cde''localhost' (using
    password: YES)

    Which does not give a lot of details. I've gone through the mysql log,
    no mention of what went wrong.

    After wiping the anonymous logins, sorted.

    Regards,
    Hein
    >
    > Hein, In addition to what Giuseppe said - are you installing this on
    > Windows or Unix/Linux? For instance, 'localhost' is handled differently
    > on Linux, for instance - MySQL uses a socket instead of tcpip.
    >
    > And yes, the error message you're getting is critical to diagnosing the
    > problem.
    >
    > --
    > ==================
    > Remove the "x" from my email address
    > Jerry Stuckle
    > JDS Computer Training Corp.
    > [email]jstucklexattglobal.net[/email]
    > ==================
    Hein Guest

Similar Threads

  1. CS3 will not connect
    By alfie conway in forum Macromedia Contribute Connection Administrtion
    Replies: 0
    Last Post: December 13th, 01:15 PM
  2. Can't connect
    By Shelly in forum MySQL
    Replies: 5
    Last Post: January 18th, 06:50 PM
  3. How to use “RDS.Connect” to connect to a MS Access database?
    By hannaman@msn.com in forum ASP Database
    Replies: 0
    Last Post: August 2nd, 11:09 PM
  4. Connect to IDS 9.4 with 16 bit BDE
    By Yves Glodt in forum Informix
    Replies: 1
    Last Post: September 4th, 12:52 PM
  5. Cannot connect to db
    By dj Bass in forum ASP.NET Security
    Replies: 9
    Last Post: July 16th, 07:11 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