List:General Discussion« Previous MessageNext Message »
From:Ken Menzel Date:September 30 2008 4:05pm
Subject:Re: Ancient, unsolved high-CPU problem -- vmstat, top and ps
View as plain text  
from http://dev.mysql.com/doc/refman/5.1/en/connecting.html

On Unix, MySQL programs treat the hostname |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. This 
occurs even if a |--port| or |-P| option is given to specify a port 
number. To ensure that the client makes a TCP/IP connection to the local 
server, use |--host| or |-h| to specify a hostname value of |127.0.0.1|, 
or the IP address or name of the local server. You can also specify the 
connection protocol explicitly, even for |localhost|, by using the 
|--protocol=TCP| option. For example:

shell> *|mysql --host=127.0.0.1|*
shell> *|mysql --protocol=TCP

|*

*|Just try it. localhost is trated as a special name used for the 
socketfile. If you want to use 127.0.0.1 or have programs that use that 
then you will need to specify 127.0.0.1 when using skip-dns option.  It 
does not hurt to grant both localhost and 127.0.0.1 if you are unsure 
when you are not using DNS.

Ken
|**||*
*||*



Rene Fournier wrote:
> So with skip-name-resolve in my.cnf (and MySQL restarted), it should
> be okay to have user@localhost in the GRANT table since localhost
> resolves without DNS lookup? Or do I need to specify user@stripped?
>
> Sorry, just need to clarify this bit before changing a few things.
> Thanks again.
>
> ...Rene
>
> On 24-Sep-08, at 3:33 PM, Ken Menzel wrote:
>
>   
>>   Yes, you can still use a hostname in the connection string, that's
>> not what mysql uses it for, that hostname gets you from the client
>> to the server.  If you use GRANT to permit access from certain hosts
>> IE 'grant all on mydb.* to 'mydbuuser'@'%.mydomain.com'.  Then the
>> server will not be able to resolve those named permissions from the
>> connecting  IP back to a domain name matched to a grant to allow
>> login. Also I don't think you can use subnets in a grant, you can
>> use a single IP. However  'myuser'@'%' should continue to work just
>> fine as should localhost using the file socket.  Everything else
>> should behave normally.  Localhost connections are usually through
>> the the mysql socket file (/tmp/mysql.sock) not 127.0.0.1 and is
>> mapped to localhost.
>>     
>
>   

Thread
Ancient, unsolved high-CPU problemRene Fournier22 Sep
Re: Ancient, unsolved high-CPU problemRene Fournier22 Sep
  • Re: Ancient, unsolved high-CPU problemJeffrey Santos23 Sep
    • Re: Ancient, unsolved high-CPU problemRene Fournier23 Sep
      • Re: Ancient, unsolved high-CPU problemDoug Bridgens23 Sep
        • Re: Ancient, unsolved high-CPU problemRene Fournier23 Sep
          • Re: Ancient, unsolved high-CPU problemDoug Bridgens23 Sep
        • Re: Ancient, unsolved high-CPU problem -- vmstat, top and psRene Fournier23 Sep
          • Re: Ancient, unsolved high-CPU problem -- vmstat, top and psKen Menzel23 Sep
            • Re: Ancient, unsolved high-CPU problem -- vmstat, top and psRene Fournier24 Sep
              • RE: Ancient, unsolved high-CPU problem -- vmstat, top and psMartin Gainty24 Sep
                • Re: Ancient, unsolved high-CPU problem -- vmstat, top and psRene Fournier30 Sep
              • Re: Ancient, unsolved high-CPU problem -- vmstat, top and psKen Menzel24 Sep
                • Re: Ancient, unsolved high-CPU problem -- vmstat, top and psRene Fournier30 Sep
                  • Re: Ancient, unsolved high-CPU problem -- vmstat, top and psKen Menzel30 Sep