LaravelDaily/Laravel-Event-Conference-Demo

Please error running php artisan migrate --seed

Closed this issue · 9 comments

mafuz commented

$ php artisan migrate --seed

Illuminate\Database\QueryException : SQLSTATE[HY000] [1049] Unknown database 'laravel' (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')

at C:\xampp\htdocs\EventConference\vendor\laravel\framework\src\Illuminate\Database\Connection.php:665
661| // If an exception occurs when attempting to run a query, we'll format the error
662| // message to include the bindings with SQL, which will make this exception a
663| // lot more helpful to the developer instead of just the database's errors.
664| catch (Exception $e) {

665| throw new QueryException(
666| $query, $this->prepareBindings($bindings), $e
667| );
668| }
669|

Exception trace:

1 Doctrine\DBAL\Driver\PDOException::("SQLSTATE[HY000] [1049] Unknown database 'laravel'")
C:\xampp\htdocs\EventConference\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:31

2 PDOException::("SQLSTATE[HY000] [1049] Unknown database 'laravel'")
C:\xampp\htdocs\EventConference\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:27

Please use the argument -v to see more details.

@mafuz sorry but your errors are about configuration, not about our code.

In here, code is expecting database called "laravel" and you haven't created it. Check .env and config/database.php files for database name and credentials.

mafuz commented

i have done that below is my .env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

and database
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],

@mafuz have you created database called "laravel"?

mafuz commented

yes shown above thank you, sir.

@mafuz it doesn't show that you CREATED new database. Your error says "unknown database laravel". Sorry we don't provide free support for such misconfiguration.

mafuz commented

ok

i am the same problem
please help me