Jump to content


Photo

Host Options When Adding A User


  • Please log in to reply
2 replies to this topic

#1 malik

malik

    Member

  • 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?
TIA

#2 peterlaursen

peterlaursen

    Advanced Member

  • Admin
  • PipPipPip
  • 7,869 posts
  • Gender:Male
  • Location:Skagen, Denmark
  • Interests:well ... jazz/folk music, photography, chess, nature, ecology, history, bicycling, Highland Malts ... well, Lowland Malts and Cognac too actually :-) just wonder how I get the time to touch a computer! SQLyog and MONyog? no that's not interest, that's BASIC NEEDS simply!

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 10.0.0.0, 10.0.0.1, 10.0.0.2, .. , 10.0.0.9 (but not 10.0.0.10 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
Webyog

#3 Samatva

Samatva

    Newbie

  • 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