Google


ADBRITE ads links
You are here: CodeIdol.com > Unix > Linux® Quick Fix > Basic MySQL Configuration > Very Basic MySQL Network Security

SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

Very Basic MySQL Network Security

By default MySQL listens on all your interfaces for database queries from remote MySQL clients. You can see this using netstat an. Your server will be seen to be listening on IP address 0.0.0.0 (all) on TCP port 3306.

     [root@bigboy tmp]# netstat -an
     Active Internet connections (servers and established)
     Proto Recv-Q Send-Q Local Address          Foreign Address
     State
     ...
     ...
     tcp        0      0 0.0.0.0:3306           0.0.0.0:*
     LISTEN
     ...
     ...
     [root@bigboy tmp]#

The problem with this is that it exposes your database to MySQL queries from the Internet. If your SQL database is going to be accessed only by applications running on the server itself, then you can force it to listen only to the equivalent of its loopback interface. Here's how:

1.
Edit the /etc/my.cnf file and use the bind-address directive in the [mysqld] section to define the specific IP address on which MySQL listens for connections:

     [mysqld]
     bind-address=127.0.0.1

2.
Restart MySQL. The netstat -an command will show MySQL listening on only the loopback address on TCP port 3306, and your application should continue to work as expected.

    SAVE
    Digg
    Shown on del.icio.us del.icio.us
    See Whos Talking About This on Technorati Technorati
    I've Reddit reddit

    You are here: CodeIdol.com > Unix > Linux® Quick Fix > Basic MySQL Configuration > Very Basic MySQL Network Security
       
    Related tags







    Popular Categories
    Unix books and guides
    AJAX popular information
    C# language guides
    Windows books and cookbooks
    .......






    © CodeIdol Labs, 2007