search

Home  >  Q&A  >  body text

Laravel project uploaded from local to cloud server cache update problem

When developing on local windows, the database name in the .env file is called test. I ftp the entire project folder to the server (centos7), and the database name in the env file is changed to laravel.
Then execute php artisan migrate, but the following error occurs, saying that the test database cannot be found:

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

There is no test database in the first place, where does it come from?
Is this a cache issue? How should I do it?

This isdatabase.php:

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

edit:

This is the .env file of the cloud host:

    APP_ENV=production
    APP_KEY=base64:fzg/000000000000000001qfE0=
    APP_DEBUG=false
    APP_LOG_LEVEL=debug
    APP_URL=http://localhost
    
    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=laravel
    DB_USERNAME=root
    DB_PASSWORD=

This is the .env file on the local machine:

    APP_ENV=local
    APP_KEY=base64:fzg/000000000000000001qfE0=
    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=test
    DB_USERNAME=root
    DB_PASSWORD=
phpcn_u1582phpcn_u15822776 days ago480

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-05-16 16:51:17

    php artisan cache:clear

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 16:51:17

    composer dumpautoload 试试
    datebase.php 是 'default' => 'mysql', ?

    reply
    0
  • Cancelreply