Laravel Migration-说未知数据库,但已创建 [英] Laravel Migration - Says unknown database, but it is created

查看:55
本文介绍了Laravel Migration-说未知数据库,但已创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用php artisan migrate时,出现错误SQLSTATE[42000] [1049] Unknown database 'databaseName'.

when I use php artisan migrate, i get the error SQLSTATE[42000] [1049] Unknown database 'databaseName'.

但是数据库确实存在!我什至尝试返回终端,登录mysql并再次创建数据库,它说数据库已经存在!

But the database DOES exists! I even tried going back into terminal, logged into mysql and created the database again, and it said that database already exists!

这为什么会给我这个错误?

Why is this giving me this error?

推荐答案

在您的app/config/database.php文件中,将默认值从databaseName更改为您要在应用程序中尝试使用的真实数据库名称,如下所示(对于mysql驱动程序):

In your app/config/database.php file change the default value from databaseName to a real database name that you are trying to use in your application, something like this (for mysql driver):

'mysql' => array(
    'driver'    => 'mysql',
    'host'      => 'localhost',
    'database'  => 'your database name', //<-- put the database name
    'username'  => 'your user name',
    'password'  => 'your password',
    'charset'   => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix'    => '',
),

这篇关于Laravel Migration-说未知数据库,但已创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆