Symfony2 like database creation command in laravel console?

后端 未结 3 690
忘了有多久
忘了有多久 2021-01-16 20:32

I have used symfony2 console to create database. If I want to create a database named \"symfony\" I usually mentioned that name in parameters.yml file and run the below comm

3条回答
  •  粉色の甜心
    2021-01-16 21:27

    I think you can not create database through command so go to app/config/database.php and set your database configuration. details here

    'mysql' => array(
        'read' => array(
            'host' => '192.168.1.1',
        ),
        'write' => array(
            'host' => '196.168.1.2'
        ),
        'driver'    => 'mysql',
        'database'  => 'database',
        'username'  => 'root',
        'password'  => '',
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
    ),
    

    after setting you can create table through command

    php artisan migrate:make create_user_table --table=users
    

    it will generate a file to app/database/migrations name create_users_table. . . . . then you create your table following this link

    and finally run this command php artisan migrate

提交回复
热议问题