## Index → Modules → Validators

### Validator: Mysql

The MySQL validator allows you to authenticate a user against a MySQL database.

Table: Parameters
Parameter | Description
--- | ---
host | Optional. The server that is running the MySQL database server. Default: localhost.
port | Optional. The port that MySQL is listening on. Default: 3306.
unix_socket | Optional. A Unix socket.
user | The MySQL user to authenticate as.
passwd | The MySQL user password to use.
database | Required. The MySQL database to select upon connection.
query | Required. The query to execute to authenticate the HTTP user.
use_md5_passwd | Optional. The passwords in the database table are hashed with MD5. Default: 0.

The `query` parameter is given an argument `${user}` so you can query against it.

Example: Sample query

        SELECT password FROM auth_users WHERE username = '${user}'

The query must return one row with one column as the password. The name of the column does not matter.

#### Compatibility

This validator is compatible with both basic and digest schemes.