Tuesday, 6 February 2018

Using % for host when creating a MySQL user



My MySQL database needs two users: appuser and support.
One of the application developers insists that I create four accounts for these users:



appuser@'%'
appuser@'localhost'

support@'%'
support@'localhost'


For the life of me I can't figure out why he thinks we need this. Wouldn't using the wildcard as the host take care of the 'localhost'?



Any ideas?



(Using MySQL 5.5 here)


Answer




localhost is special in MySQL, it means a connection over a UNIX socket (or named pipes on Windows, I believe) as opposed to a TCP/IP socket. Using % as the host does not include localhost, hence the need to explicitly specify it.


No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...