Create database with mysql in Laravel projects
First, log in your mysql with command:
mysql -uroot -p
Enter password,then, we are in your database ‘mysql’ now. And create the database with name you set in your project ‘.env’ file. The example name is ‘blog’ as blow.
create database blog;
Then quit from mysql.
php artisan migrate
You will get results as below.
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table (44.52ms)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table (37.12ms)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated: 2019_08_19_000000_create_failed_jobs_table (41.26ms)
Migrating: 2019_12_14_000001_create_personal_access_tokens_table
Migrated: 2019_12_14_000001_create_personal_access_tokens_table (61.77ms)
That’s go back to check with mysql.
mysql -uroot -p
Enter password
use blog;
show tables;
The show is as below.
±-----------------------+
| Tables_in_blog |
±-----------------------+
| failed_jobs |
| migrations |
| password_resets |
| personal_access_tokens |
| users |
±-----------------------+
5 rows in set (0.001 sec)
Done, and quit.