## Index → Modules → Validators

### Validator: Mysql

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

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.
hash | Optional. What the passwords in the database table are hashed with. Valid options are sha1 md5 or none. Default: none.

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

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.