0

I turned debugging on with my local installation, and find out that i cant get into database.

A Database Error Occurred Unable to connect to your database server using the provided settings.

Filename: C:\wamp\www\siteA\system\codeigniter\system\database\DB_driver.php

Line Number: 124

I have checked the config and database.php files and all should be good to go. Any idea what i could do, to get into CP?

Thanks in advance.

  • I guess it could be a parameter problem, or a problem with the wamp server that cause this error. Debugging not affect the database parameters. – Stéphane Apr 18 '14 at 14:17
2

It sounds to me like you'll need to setup a multi-environment /system/expressionengine/config/database.php file. Here's a glimpse of how I typically set mine up:

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

if ($_SERVER['HTTP_HOST']  == 'PRODUCTIONSERVER.com') {

    $active_group = 'production';

} elseif ($_SERVER['HTTP_HOST']  == 'DEVELOPMENTSERVER.com') {

    $active_group = 'development';

} elseif ($_SERVER['HTTP_HOST']  == 'YOURLOCALDOMAIN.dev') {

    $active_group = 'local';

} else {

    $active_group = 'production';
}

$db['local']['hostname'] = 'localhost';
$db['local']['username'] = 'root';
$db['local']['password'] = 'YOUR PASSWORD';
$db['local']['database'] = 'DATABASENAME';
$db['local']['dbdriver'] = 'mysql';
$db['local']['pconnect'] = FALSE;
$db['local']['dbprefix'] = 'exp_';
$db['local']['swap_pre'] = 'exp_';
$db['local']['db_debug'] = TRUE;
$db['local']['cache_on'] = FALSE;
$db['local']['autoinit'] = FALSE;
$db['local']['char_set'] = 'utf8';
$db['local']['dbcollat'] = 'utf8_general_ci';
$db['local']['cachedir'] = '{$_SERVER["DOCUMENT_ROOT"]}SYSTEMFOLDER/expressionengine/cache/db_cache/';

$db['development']['hostname'] = 'DEV HOST NAME';
$db['development']['username'] = 'DEV USER NAME';
$db['development']['password'] = 'DEV PASSWORD';
$db['development']['database'] = 'DEV DATABASE';
$db['development']['dbdriver'] = 'mysql';
$db['development']['pconnect'] = FALSE;
$db['development']['dbprefix'] = 'exp_';
$db['development']['swap_pre'] = 'exp_';
$db['development']['db_debug'] = TRUE;
$db['development']['cache_on'] = FALSE;
$db['development']['autoinit'] = FALSE;
$db['development']['char_set'] = 'utf8';
$db['development']['dbcollat'] = 'utf8_general_ci';
$db['development']['cachedir'] = '{$_SERVER["DOCUMENT_ROOT"]}SYSTEMFOLDER/expressionengine/cache/db_cache/';

$db['production']['hostname'] = 'PRODUCTION HOST NAME';
$db['production']['username'] = 'PRODUCTION USER NAME';
$db['production']['password'] = 'PRODUCTION PASSWORD';
$db['production']['database'] = 'PRODUCTION DATABASE';
$db['production']['dbdriver'] = 'mysql';
$db['production']['pconnect'] = FALSE;
$db['production']['dbprefix'] = 'exp_';
$db['production']['swap_pre'] = 'exp_';
$db['production']['db_debug'] = TRUE;
$db['production']['cache_on'] = FALSE;
$db['production']['autoinit'] = FALSE;
$db['production']['char_set'] = 'utf8';
$db['production']['dbcollat'] = 'utf8_general_ci';
$db['production']['cachedir'] = '{$_SERVER["DOCUMENT_ROOT"]}SYSTEMFOLDER/expressionengine/cache/db_cache/';


?>

I hope that helps!

| improve this answer | |
1

hummm try to have a look on your .htaccess file. And have a look to in the index.php in the site root to verify the system path:

 $system_path = './system';

The path on your local/wamp server could be different from the production site

| improve this answer | |
0

The basing settings inside (database.php in the config folder) when using Wamp for EE are:

    $db['expressionengine']['hostname'] = 'localhost';
    $db['expressionengine']['username'] = 'root';
    $db['expressionengine']['password'] = '';
    $db['expressionengine']['database'] = 'name_of_your_database';
    $db['expressionengine']['dbdriver'] = 'mysql';$db['expressionengine']['pconnect'] = FALSE;
    $db['expressionengine']['dbprefix'] = 'exp_';
    $db['expressionengine']['swap_pre'] = 'exp_';
    $db['expressionengine']['db_debug'] = TRUE;
    $db['expressionengine']['cache_on'] = FALSE;
    $db['expressionengine']['autoinit'] = FALSE;
    $db['expressionengine']['char_set'] = 'utf8';
    $db['expressionengine']['dbcollat'] = 'utf8_general_ci';
    $db['expressionengine']['cachedir'] = '/localhost/system/expressionengine/cache/db_cache/';
| improve this answer | |
  • Thanks but I've changed the root-user to have password in wamp, and im trying to use the database imported to wamp, from my live site. Basic installation of EE went just fine and all works with it. But when i change the database to be using the other, site is closed and cant access to CP. – Riverboy Apr 18 '14 at 15:00
  • Forgot to say, that database connection do then work but EE itself gives this error when I try to access CP: You are not authorized to perform this action. And localhost/siteA is redirecting me to example.com. So I must be missing something? – Riverboy Apr 18 '14 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.