Support the ongoing development of Laravel.io →
Configuration Authentication Database

I'm new to Laravel and I'm trying to fix next issue for 2 days. I want to create database and migration in it. In my database.php: 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'news'), 'username' => env('DB_USERNAME', 'root'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => true, 'engine' => null, ],

In my .env:

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=news DB_USERNAME=root DB_PASSWORD=''

But while php artisan migrate:install OR php artisan migrate I recieve: [PDOException]
SQLSTATE[HY000] [1049] Unknown database 'news'

What is more, that I'm able to create migration by using: php artisan make:migration create_users_tab

Questions: 1- How to administrate database throught (PhpMyAdmin) - like in appache??-doesn't work 2 - How to add database? 3 - Should Laravel Project Folder be placed in Apache www Folder?

THANKS IN ADVANCE, I'm new to Laravel

Last updated 2 years ago.
0

In terminal login to mysql

mysql -uroot -p

when asked for password just press enter.

To create a database

create database news

Now you should be able to migrate to the database.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

ggladko97 ggladko97 Joined 20 Feb 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.