Jump to content


Host Options When Adding A User

  • Please log in to reply
2 replies to this topic

#1 malik



  • Members
  • PipPip
  • 16 posts

Posted 11 May 2012 - 04:32 PM

When adding a user what are the options for the 'host' field.
i.e. using 'localhost' will allow the user to connect locally. If you want the user to be able to connect remotely should you use '%' ?.
Are there any other choices?

#2 peterlaursen


    Advanced Member

  • Admin
  • PipPipPip
  • 8,148 posts
  • Gender:Male
  • Location:Skagen, Denmark

Posted 11 May 2012 - 06:58 PM

The 'host' in a MySQL user definition is the host (ip or hostname) of the machine where the client runs. a hostname' requires tthat DNS lookup has not been disabled with the skip-name-resolve option (http://dev.mysql.com...ip-name-resolve).

You may use SQL-wildcards ("%" and "_") in a user definition, so for example

'someuser'@'%' can connect from anywhere (as "%" is the SQL wildcard for any number of any characters)
'someuser'@'10.0.0._' can connect from the ip's,,, .. , (but not etc. as "_" is the SQL wildcard for a single character).

See more here: http://dev.mysql.com...ount-names.html
Computers make your grey hair come off ....

Peter Laursen

#3 Samatva



  • Members
  • Pip
  • 2 posts

Posted 14 May 2012 - 03:46 PM

Using "%" will allow anyone on the Internet to attempt to connect, making your database more open to hackers. We always use no more open than "123.45.%" to allow only connecting from our local (campus) network (we have a VPN in that range for remote access).

Note also that you must set the "bind-address" config to the network port(s) to be used (in /etc/mysql/my.cnf on Ubuntu).
See http://dev.mysql.com...n/security.html for security considerations...

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users