Zone security MySQL with Apache  Hot PDF Print E-mail
Tag it:
Delicious
Furl it!
Digg
NewsVine
Reddit
YahooMyWeb
Technorati
Articles Reviews Mysql
Written by Radu Mazare   
Monday, 09 October 2006
Article Index
Zone security MySQL with Apache  Hot
Installing the module
Configuration and Usage
Configuration Options
Configuration ..

{mos_sb_discuss:27}

Installing and configuring mod_auth_mysql involves a few steps, the first of which is to create the necessary database structures to hold the user data. Start by loading up your favorite MySQL client, and creating the database. For example:



  CREATE DATABASE apacheauth;


Next, create a user that will be used by Apache to access the credentials:

     GRANT SELECT ON apacheauth.* TO apache@localhost IDENTIFIED BY `apachepass';

Now that the database user is created, it's time to add a table to hold the login information. For now start out with a simple table that just holds the username and password:

    USE apacheauth;

     CREATE TABLE user_info (

        user_name varchar(50) NOT NULL,

         user_password varchar(50) NOT NULL,

         PRIMARY KEY (user_info)

       );

You can name the table and columns however you like. In the preceding example, user_info is used  for the table name, and user_name and user_password are used for the login/password combination because these are the default names recognized by mod_auth_mysql.

       In later versions of mod_auth_mysql, the default column for password is user_password, not
       user_passwd as it states in the module documentation.
 

Next, create an initial test user account that you'll use later when testing the authentication:

      INSERT INTO user_info (user_name, user_password)

       VALUES (`testuser', SHA1(`testpass'));

Notice that the SHA1 function is used on the password in the statement, instead of the PASSWORD() function. With mod_auth_mysql you can use a handful of encryption methods for the password -- this example, just happens to use SHA1.  



Last Updated ( Sunday, 08 July 2007 )
 
< Prev   Next >