laravel migration:未知数据库

时间:2017-01-12 15:14:24

标签: php mysql database migration

我是php和laravel的全部新手。我在互联网上关注了tuto。我试图创建名为" links"的表,但是,我收到了这个错误:

[PDOException]
SQLSTATE[HY000] [1049] Unknown database 'createlinkstable'

这是文件" database.php":

<?php

return [

'fetch' => PDO::FETCH_OBJ,

'default' => env('DB_CONNECTION', 'mysql'),

'connections' => [

    'sqlite' => [
        'driver' => 'sqlite',
        'database' => env('DB_DATABASE', database_path('database.sqlite')),
        'prefix' => '',
    ],

    'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'CreateLinksTable'),
        'username' => env('DB_USERNAME', 'root'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => null,
    ],


],

'migrations' => 'migrations',

'redis' => [

    'cluster' => false,

    'default' => [
        'host' => env('REDIS_HOST', '127.0.0.1'),
        'password' => env('REDIS_PASSWORD', null),
        'port' => env('REDIS_PORT', 6379),
        'database' => 0,
    ],
],

];

这是文件&#34; .env&#34;

APP_ENV=local
APP_KEY=*******
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=CreateLinksTable
DB_USERNAME=root
DB_PASSWORD=

当我尝试执行此命令时,&#34; php artisan migrate&#34;我收到了错误

我应该手动创建数据库CreateLinksTable吗?如果有,怎么样?

N.B:我正在使用easyphp

enter image description here

我正在阅读这篇文章,但它没有帮助(Access denied for user 'homestead'@'localhost' (using password: YES)

0 个答案:

没有答案