Access denied - hostname is percent character ('%')?

1,167 views
Skip to first unread message

Ishmael

unread,
Feb 16, 2012, 9:55:14 PM2/16/12
to Django users
I'm trying to follow the intro tutorial.
I am able to log in to my database from the command line (and via
MySQL Workbench) sans problem:
However, after changing my settings file to the correct values, I get:

_mysql_exceptions.OperationalError: (1044, "Access denied for user
'myuser'@'%' to database 'Mydatabase'")

My settings file contains:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'Mydatabase', # Or path to
database file if using sqlite3.
'USER': 'myuser', # Not used with
sqlite3.
'PASSWORD': 'mypassword', # Not used with
sqlite3.
'HOST': 'my.url.com', # Set to empty
string for localhost. Not used with sqlite3.
'PORT': '3306', # Set to empty string for
default. Not used with sqlite3.
}
}

How do I get rid of the '%' percent symbol for the local hostname?

Thanks for your help!
Message has been deleted

Tom Evans

unread,
Feb 17, 2012, 12:10:14 PM2/17/12
to django...@googlegroups.com
On Fri, Feb 17, 2012 at 4:31 PM, Dennis Lee Bieber
<wlf...@ix.netcom.com> wrote:

> On Thu, 16 Feb 2012 18:55:14 -0800 (PST), Ishmael <stahl...@gmail.com>
> wrote:
>
>
>>_mysql_exceptions.OperationalError: (1044, "Access denied for user
>>'myuser'@'%' to database 'Mydatabase'")
>>
>>My settings file contains:
>>
>>DATABASES = {
>>        'HOST': 'my.url.com',                      # Set to empty
>>string for localhost. Not used with sqlite3.
>
>>        'PORT': '3306',                      # Set to empty string for
>>default. Not used with sqlite3.
>>    }
>>}
>>
>>How do I get rid of the '%' percent symbol for the local hostname?
>>
>        One -- you aren't using "localhost" to connect. Is MySQL's port open
> to connections asking for "my.url.com".  That is, rather than connecting
> to (localhost, MySQLPort) you are connecting via (my.url.com,
> MySQLPort). {BTW: you may also be caught be another twitch -- about a
> quarter way down http://dev.mysql.com/doc/refman/5.0/en/connecting.html
> """
> On Unix, MySQL programs treat the host name localhost specially, in a
> way that is likely different from what you expect compared to other
> network-based programs. For connections to localhost, MySQL programs
> attempt to connect to the local server by using a Unix socket file.
> """
>
>
>        Second -- if the port is open, have you added your user/password to
> the NON-localhost account table (% is the wildcard for connecting host
> address). The local tools are using localhost, not "my.url.com" to
> connect.

I have no real insight on why the OP is getting this error message,
but I would imagine the fact that they are getting an error response
back from the server probably indicates that they are connecting ok to
the server process.

Cheers

Tom

Ishmael

unread,
Feb 17, 2012, 12:18:31 PM2/17/12
to Django users
Thanks for the reply. The solution to the problem was excruciatingly
simple. I accidentally capitalized the name of the database, when the
actual name is not capitalized. (Why on Earth doesn't the error
message say: "The database 'Mydatabase' doesn't exist." ?)

Thanks a lot for your time anyway!


On Feb 17, 8:31 am, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote:
> On Thu, 16 Feb 2012 18:55:14 -0800 (PST), Ishmael <stahl.k...@gmail.com>
> wrote:
>
> >_mysql_exceptions.OperationalError: (1044, "Access denied for user
> >'myuser'@'%' to database 'Mydatabase'")
>
> >My settings file contains:
>
> >DATABASES = {
> >        'HOST': 'my.url.com',                      # Set to empty
> >string for localhost. Not used with sqlite3.
> >        'PORT': '3306',                      # Set to empty string for
> >default. Not used with sqlite3.
> >    }
> >}
>
> >How do I get rid of the '%' percent symbol for the local hostname?
>
>         One -- you aren't using "localhost" to connect. Is MySQL's port open
> to connections asking for "my.url.com".  That is, rather than connecting
> to (localhost, MySQLPort) you are connecting via (my.url.com,
> MySQLPort). {BTW: you may also be caught be another twitch -- about a
> quarter way downhttp://dev.mysql.com/doc/refman/5.0/en/connecting.html
> """
> On Unix, MySQL programs treat the host name localhost specially, in a
> way that is likely different from what you expect compared to other
> network-based programs. For connections to localhost, MySQL programs
> attempt to connect to the local server by using a Unix socket file.
> """
>
>         Second -- if the port is open, have you added your user/password to
> the NON-localhost account table (% is the wildcard for connecting host
> address). The local tools are using localhost, not "my.url.com" to
> connect.
> --
>         Wulfraed                 Dennis Lee Bieber         AF6VN
>         wlfr...@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Andres Reyes

unread,
Feb 17, 2012, 12:35:43 PM2/17/12
to django...@googlegroups.com
Saying that the database doesn't exists would be giving to much
information to potential atackers triying to connect

2012/2/17 Ishmael <stahl...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
Andrés Reyes Monge
arm...@gmail.com
+(505)-8873-7217

Reply all
Reply to author
Forward
0 new messages