4

I'm following through the Quick Start Guide, and got to the section actually connecting to the DB to fetch the users table, and am getting the following error:

SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)

My database.php includes the following setup (default set to mysql):

'mysql' => array(
    'driver'    => 'mysql',
    'host'      => 'localhost',
    'database'  => 'bt',
    'username'  => 'root',
    'password'  => '',
    'charset'   => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix'    => '',
),

When I go to the terminal window, however, I'm able to log in using mysql -h localhost -u root -p then just hit enter to go in without a password, which I thought would be equivalent (the 'bt' table shows up when I run show databases();). What am I missing here?

Jonathan Bender
  • 1,911
  • 4
  • 22
  • 39

2 Answers2

7

I think this is the solution :)

'mysql' => array(
    'driver'    => 'mysql',
    'host'      => '127.0.0.1',
    'database'  => 'bt',
    'username'  => 'root',
    'password'  => '',
    'charset'   => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefi
1

It's also possible that pdo is not installed on your machine. You can check if it's installed from the phpinfo() page or a php script

if ( extension_loaded('pdo') ) {
    .......
}

On linux you can install it by

sudo apt-get install php5-mysql
just_some_guy
  • 11
  • 1
  • 1