Locking down MySql

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
mabsey
Forum Newbie
Posts: 4
Joined: Wed Jun 27, 2007 8:50 am

Locking down MySql

Post by mabsey »

Hi everyone,

Is there a way to lock down mysql so it only accepts connections from the Local Host?

Thanks

Mabs
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Who else has access to it??
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

You can specify user privileges including whether or not they are allowed to access databases remotely. You can also disable access remotely to MySQL completely in the my.cnf file.
mabsey
Forum Newbie
Posts: 4
Joined: Wed Jun 27, 2007 8:50 am

Post by mabsey »

superdezign wrote:Who else has access to it??
Just myself.

I ideally what I would like to say is. Only allow the IP address of my machine to connect and also allow all server side scripts to run. If it means I have to lock it down to server side only and access the database via the web interface I will.

Mabsey
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

All you have to do then is ensure that every MySQL user only has access from localhost. Then you can create a single account that has remote access for you to use remotely. You can do this in phpMyAdmin if your not sure how to.

Other solutions would be to disable all remote access, then create a tunnel over SSH and access the database that way.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

mabsey wrote:Only allow the IP address of my machine to connect and also allow all server side scripts to run.
Like, an administration section? The admin section is only as secure as you make it.
Post Reply