42

On a freshly installed (windows version of) MySQL 5.5.9

SELECT user, host FROM mysql.user

gives:

user            host    

root        localhost   
root        127.0.0.1    
root        ::1  
localhost    

But what IP/hostname does ::1 stand here for?

Arne Evertsson
  • 19,693
  • 20
  • 69
  • 84
mlvljr
  • 4,066
  • 8
  • 44
  • 61

1 Answers1

65

::1 is the IPv6 address for localhost.

The details (incl.those relevant to the Windows case) are at http://dev.mysql.com/doc/refman/5.5/en/default-privileges.html.

Arne Evertsson
  • 19,693
  • 20
  • 69
  • 84
Brian Driscoll
  • 19,373
  • 3
  • 46
  • 65
  • 1
    It has nothing to do with what MySQL uses; it has to do with what your system uses. The datatype of the host column is varchar; you could put just about anything in there... – Brian Driscoll Feb 22 '11 at 17:21
  • 9
    More specifically, the IPv6 address for localhost is `0000:0000:0000:0000:0000:0000:0000:0001`, but all those zeros can be abbreviated, shortening the address down to `::1`. – R. Martinho Fernandes Feb 22 '11 at 17:25
  • @Brian Driscoll So, even if IPv6 is not installed in the system, the address will probably be still there? Seems interesting, esp. if one remembers MySQL's "pre-cooking" of some values in the `host` column (http://dev.mysql.com/doc/refman/5.0/en/account-names.html). – mlvljr Feb 22 '11 at 17:42
  • oops! Found it myself: http://dev.mysql.com/doc/refman/5.5/en/default-privileges.html. – mlvljr Feb 22 '11 at 17:56
  • @mlvljr Why are there 3 references to `localhost`, One by the name, by IPv4 address and one by `::1` (IPv6) ? – Suvarna Pattayil May 21 '13 at 13:14
  • @SuvP I think the documentation and that book written by one of the maintainers (dont' remember the title now, but the text is very clear) should address that; have not looked into this in a cpl of years, and don't have time to do that right now, sorry. [but could find that book a bit later today, if if you think you need a good read on MySQL] – mlvljr May 21 '13 at 13:29
  • 1
    @mlvljr Thanks for your time, Do drop in a link someday if you recall. – Suvarna Pattayil May 21 '13 at 13:46
  • @SuvP The book is Paul DuBois' "MySQL" (Developer's library series), http://www.amazon.com/dp/0672329387 (the edition I was reading, there's also 5th one available now). Best wishes from Russia :) – mlvljr May 21 '13 at 20:44