PDOException SQLSTATE[HY000] [1049] Unknown database 'forge' failed

34,312

Solution 1

Do you have something like app/config/yourEnvironment/database.php ? For example local or production. 'forge' is default name of DB in this config file, so it looks like your app is loading wrong config file.

Solution 2

remove two files config.php and services.php in /bootstrap/cache. And try again.

Share:
34,312
Ironheartbj18
Author by

Ironheartbj18

The best way to get better at programming is to use what you have learned to build something

Updated on July 03, 2020

Comments

  • Ironheartbj18
    Ironheartbj18 almost 4 years

    I want to access a Mysql data the first step is to create a new table for "vanvlymen" and I typed mysql> USE vanvlymen; the database changed. and type SHOW tables; showing the available of the tables that the database contains.

    mysql -u root -p 
    enter password: ****
    
    mysql> show databases;
    -databases-
    
     information_schema
     mysql
     performance_schema
     phpmyadmin
     vanvlymen
    
     5 rows...
    

    everything is looking good... I have decide to tell mysql to specify the database I am working on before executing the query as "vanvlymen"

    app/config/database.php

       'mysql' => array(
            'driver'    => 'mysql',
            'host'      => 'localhost',
            'database'  => 'vanvlymen',
            'username'  => 'foobar',
            'password'  => 'foobar',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ),
    

    save as file go to FileZilla using FTP find a file drag and drop into my live server overwrite the database.php file.

    I have tried to clear the cache like that

     php artisan cache:clear 
    
     php artisan migrate
    

    it errors:

     SQLSTATE[42000] [1049] unknown database 'forge'. 
    

    Why keeping it said unknown database 'forge' I am excepting to change to vanvlymen database. Should I remove mysql and reinstall?

    I am using windows 8.1 with laravel 4.2

    Using phpmyadmin, I know what is the password and username to log in.

  • Geshode
    Geshode almost 6 years
    Add what exactly?