Search code examples
mysqllaravel-4

Laravel Migration - Says unknown database, but it is created


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

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?


Solution

  • 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'    => '',
    ),