Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie:Restrict mysql by IP?

Status
Not open for further replies.

jouell

MIS
Nov 19, 2002
304
US
Hi. I need the mysql instance running on our server (Linux)updated to allow general access from internal ip addresses, block those not in the list.

How shall I go about this? I 've searched in forums and have not found much.

Thanks!
-John
 
Great. Though, they are looking to do this via mysql.
I thought there was a way to do so? no?
 
The "mysql.users" table is used to specify which users are allowed to connect from where and what permissions they have. You can edit this table in the normal way (followed by "FLUSH PRIVILEGES"), or via the use of the GRANT statement.
 
Thanks Tony.

I am a total newbie here.

Is there a good reference for me to follow with good examples? I am not sure what the normal way is.

-jouell

 
You can use ordinary SQL statements to manipulate the table. First, see what it contains:[tt]
SELECT user,host FROM mysql.user[/tt]
then you can update the table as required, for example:[tt]
UPDATE mysql.user SET host='192.168.1.%' WHERE user=''[/tt]
The syntax of the "host" field is the same as a LIKE string, where "%" means any number of any characters. You then need to apply the changes:[tt]
FLUSH PRIVILEGES[/tt]

Alternatively, you can use the special SQL statements CREATE USER, DROP USER, GRANT, and REVOKE. These are explained in the MySQL manual, with good examples.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top