Laravel can't connect to DB

Jonathan Bender

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?

user2888062

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

node server can't connect to postgres db

From Dev

Laravel Homestead can't connect to db

From Dev

Can't connect to DB in virtual machine

From Dev

EntityFramework.IBM.DB2 can't connect to db2

From Dev

Can't connect to MySQL on live with Laravel 5

From Dev

Can't use DB Transactions in Controllers in laravel (DB::beginTransaction)

From Dev

Laravel 5 application can't connect MariaDB engine in docker container

From Dev

can't connect to DB codeIgniter

From Dev

Maria DB Can't drop table with ENGINE=CONNECT without root

From Dev

Laravel Check if can connect to DB

From Dev

Using Docker to launch web app, can't connect to Postgresql DB?

From Dev

Wordpress php sqlite can't connect to .db

From Dev

SQLite can't connect to DB from Jar

From Dev

Can't connect to DB in virtual machine

From Dev

JDBC Can't connect to my DB from a separate class. Class DB creates the connection

From Dev

Can't use DB Transactions in Controllers in laravel (DB::beginTransaction)

From Dev

Can't use DB::query in laravel

From Dev

can't connect to DB codeIgniter

From Dev

I can't connect to db or pull data

From Dev

Can't connect to Mysql server with Laravel 5.2

From Dev

Using Docker to launch web app, can't connect to Postgresql DB?

From Dev

can't connect to db in my sql

From Dev

Wordpress php sqlite can't connect to .db

From Dev

Can't connect to db - PlayFramework + Ebean

From Dev

Elixir/Phoenix can't connect to cloud hosted Postgres DB

From Dev

Connect DB In laravel 5

From Dev

Can't connect to Mysql server with Laravel 5

From Dev

Can't connect python with titan db

From Dev

My Django App can't connect to DB through a TypeError

Related Related

HotTag

Archive