Laravel cannot connect to DB

I follow through the Quick Start Guide and hit the section that actually connects to the database to retrieve the user table, and I received the following error:

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

My database.phpincludes the following setting (default is mysql):

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

However, when I go to the terminal window, I can log in using mysql -h localhost -u root -p, and then just press Enter to log in without a password, which I thought would be equivalent (the โ€œbtโ€ table appears when I started show databases();). What am I missing here?

+4
2

, :)

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

, pdo . , โ€‹โ€‹ phpinfo() PHP

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

linux

sudo apt-get install php5-mysql
+1

All Articles