Causes of Access-Denied Errors
593
Host ... is not allowed to connect to this MySQL server
You can fix this by setting up an account for the combination of client host name and user name that
you are using when trying to connect.
If you do not know the IP address or host name of the machine from which you are connecting, you
should put a row with
'%'
as the
Host
column value in the
user
table. After trying to connect from
the client machine, use a
SELECT USER()
query to see how you really did connect. Then change
the
'%'
in the
user
table row to the actual host name that shows up in the log. Otherwise, your
system is left insecure because it permits connections from any host for the given user name.
On Linux, another reason that this error might occur is that you are using a binary MySQL version
that is compiled with a different version of the
glibc
library than the one you are using. In this case,
you should either upgrade your operating system or
glibc
, or download a source distribution of
MySQL version and compile it yourself. A source RPM is normally trivial to compile and install, so
this is not a big problem.
• If you specify a host name when trying to connect, but get an error message where the host name
is not shown or is an IP address, it means that the MySQL server got an error when trying to resolve
the IP address of the client host to a name:
shell>
mysqladmin -u root -pxxxx -h some_hostname ver
Access denied for user 'root'@'' (using password: YES)
If you try to connect as
root
and get the following error, it means that you do not have a row in the
user
table with a
User
column value of
'root'
and that
mysqld
cannot resolve the host name for
your client:
Access denied for user ''@'unknown'
These errors indicate a DNS problem. To fix it, execute
mysqladmin flush-hosts
to reset the
internal DNS host cache. See
Section 8.9.8, “DNS Lookup Optimization and the Host Cache”
.
Some permanent solutions are:
• Determine what is wrong with your DNS server and fix it.
• Specify IP addresses rather than host names in the MySQL grant tables.
• Put an entry for the client machine name in
/etc/hosts
on Unix or
\windows\hosts
on
Windows.
• Start
mysqld
with the
--skip-name-resolve
[420]
option.
• Start
mysqld
with the
--skip-host-cache
[420]
option.
• On Unix, if you are running the server and the client on the same machine, connect to
localhost
. Unix connections to
localhost
use a Unix socket file rather than TCP/IP.
• On Windows, if you are running the server and the client on the same machine and the server
supports named pipe connections, connect to the host name
.
(period). Connections to
.
use a
named pipe rather than TCP/IP.
• If
mysql -u root test
works but
mysql -h your_hostname -u root test
results in
Access denied
(where
your_hostname
is the actual host name of the local host), you may
not have the correct name for your host in the
user
table. A common problem here is that the
Host
value in the
user
table row specifies an unqualified host name, but your system's name
resolution routines return a fully qualified domain name (or vice versa). For example, if you have
an entry with host
'pluto'
in the
user
table, but your DNS tells MySQL that your host name
is
'pluto.example.com'
, the entry does not work. Try adding an entry to the
user
table that
contains the IP address of your host as the
Host
column value. (Alternatively, you could add an
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...