2021-10-27 Create database with mysql in Laravel projects

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值