Zone security MySQL with Apache
|
|
|
|
| Articles Reviews Mysql | |||||||
| Written by Radu Mazare | |||||||
| Monday, 09 October 2006 | |||||||
Page 1 of 5
{mos_sb_discuss:27}
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, 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
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 > |
|---|







