Solved

MySQL User / Host Table Questions

Posted on 2006-10-23
9
2,910 Views
Last Modified: 2008-01-09
1.) Should I have to restart MySQL every time I change the “user” table?  (Windows 2003, MySQL 5.0)  It seems I have to for the changes to take effect.

2.) What about using a subnet or wildcard in the host column?  I’ve been unsuccessful with using 192.168.1.*

3.) How do I grant a user access from multiple hosts?  Do I put all hosts into the Host field, like “localhost,192.168.1.100”?  Do I have to create a new user row for every user / host combination I want to allow?  This seems counter productive to me because now I have multiple users with the same names, and potentially different passwords.

Thanks for the help and pointers here.
0
Comment
Question by:rebies
  • 5
  • 4
9 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 500 total points
ID: 17792641
1. -> no - you can use the command
mysql flush privileges;
for the changes to take effect
2. use the % sign as the wild card rather than *
3. you have to create a new row for each host that you want them to connect to.  But generally you would only give them say access from localhost, access from the lan (based on your ip prefix) and all other access % which should not be too difficult.
0
 
LVL 1

Author Comment

by:rebies
ID: 17792680
thanks for the quick reply Raynard7!  So is it unadvisable to give a user a pure "%" access?  Usually I'll want only home, work, and LAN connections for each user.  (Thus, best security says 3 rows for each user - right)
0
 
LVL 1

Author Comment

by:rebies
ID: 17792732
1.) flush privileges:  great - works!

2.) % sign:  great - works!

3.) will need to test a little bit on this one.
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17792754
Hi,

This all depends on your security model.

On most of my machines I have only localhost priv's for my users.

This is because they use business objects to query the database or are using it through a web front end - where they do not need remote use.

For other users who have access to everything I just grant all priviledges from all hosts.

Generally - the "default" user access model would be as I described above - select from % - some access from LAN and some more access from localhost (if applicable)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 35

Expert Comment

by:Raynard7
ID: 17792758
Normally you would not give access for say dropping tables from % or from the lan but you may want someone who is trusted to have access to local host to be able to execute that function... as an example
0
 
LVL 1

Author Comment

by:rebies
ID: 17792812
Thanks.   So if I want "myself" to be a user that is allowed on localhost and on the LAN - I have to create two completely seperate users - right?


0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17792853
if you want yourself to be on the lan - and on localhost but not from anywhere else you would need to use two lines in the user table.

You could also do

Grant all on % to myself@localhost;
Grant all on % to myself@192.168.0.%;

which would have the same effect
0
 
LVL 1

Author Comment

by:rebies
ID: 17792897
Thanks much Raynard!  You've definately more than answered my questions!
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17792929
glad I could help
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now