2015-11-13 09:20
浏览 226

Laravel SQLSTATE [HY000] [1049]未知数据库'previous_db_name'

I have this error when i use php artisan migrate in my Laravel project.

SQLSTATE[HY000] [1049] Unknown database 'previous_db_name'

this is my database.php file :

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

    'mysql' => [
        'driver'    => 'mysql',
        'host'      => env('DB_HOST', 'localhost'),
        'database'  => env('DB_DATABASE', 'current_db_name'),
        'username'  => env('DB_USERNAME', 'root'),
        'password'  => env('DB_PASSWORD', ''),
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
        'strict'    => false,

I saw this error in this question and this question but none of them was not helpful.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

4条回答 默认 最新

  • dtvjl64442 2015-11-13 09:23

    It clearly mentions that there's no such database named previous_db_name.

    From what it seems the database.php file is not where the variable is from.

    Check the .env file in your Laravel installation folder to see if that's the database name that you have wrongly specified.

    解决 无用
    打赏 举报

相关推荐 更多相似问题