简体   繁体   English

如何在Laravel中设置MySQL数据库

[英]How to setup mysql database in laravel

I am new laravel programmer, and I have simple question about setting up database. 我是新的laravel程序员,我对设置数据库有一个简单的问题。

Assume that I create all required migrations, models, and eloquent relationships, also configure mysql database in laravel, now in this point, is laravel will create all mysql tables required in server's DB according to migrations, models, and eloquent that I created before? 假设我创建了所有必需的迁移,模型和雄辩的关系,并且还在laravel中配置mysql数据库,现在,这时laravel是否会根据我之前创建的迁移,模型和雄辩的行为在服务器DB中创建所有mysql表? In other words, do I need to create tables in mysql server as scratch developer do? 换句话说,是否需要像草稿开发人员一样在mysql服务器中创建表?

Laravel have many commands from console. Laravel从控制台有许多命令。

from console,go to your project folder path run php artisan list to see all avaliable commands. 从控制台转到您的项目文件夹路径,运行php artisan list以查看所有可用命令。

your question asked how to create tables after you created migrations, which is php artisan migrate . 您的问题询问创建迁移后如何创建表,这就是php artisan migrate migration。

To create a migration, use the make:migration Artisan command: 要创建迁移,请使用make:migration Artisan命令:

php artisan make:migration create_users_table

To run all of your outstanding migrations, execute the migrate Artisan command: 要运行所有优秀的迁移,执行migrate工匠命令:

php artisan migrate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM