This is documentation for Kohana v2.3.x.

StatusDraft
TodoExpand

<< Back to Database Main Page

Database Configuration

To configure the database there should be a file database.php in your application/config directory. If it isn't there you should copy it from the system/config directory. It will look something like this:

$config['default'] = array
(
	'benchmark'     => TRUE,
	'persistent'    => FALSE,
	'connection'    => array
	(
		'type'     => 'mysql',
		'user'     => 'dbuser',
		'pass'     => 'p@ssw0rd',
		'host'     => 'localhost',
		'port'     => FALSE,
		'socket'   => FALSE,
		'database' => 'kohana'
	),
	'character_set' => 'utf8',
	'table_prefix'  => '',
	'object'        => TRUE,
	'cache'         => FALSE,
	'escape'        => TRUE
);

You can have as many $config entries as you need. Each one needs a unique group identifier. You can use multiple config groups to connect to different databases in the same application.

Database Drivers

The database library provides database access to your application using drivers.

Currently we have the following drivers available:

  1. MsSQL
  2. MySQL
  3. MySQLi
  4. PostgreSQL
  5. PDOSqlite (available in SVN)

Continue to the next section: Connecting to a database >>