skip to Main Content

I’m trying to use xampp for my sql server, everything works fine on that part (I can access phpmyadmin, create my db, etc). However, when I run the command "php artisan migrate" it always says te following error:

IlluminateDatabaseQueryException 

  SQLSTATE[HY000] [1049] Unknown database 'inverdana' (SQL: select * from information_schema.tables where table_schema = inverdana and table_name = migrations and table_type = 'BASE TABLE')

I have tried clearing cache, restarting the laravel server, modifying the .env file to use the address XAMPP gives, but nothing works.

It’s really frustrating that laravel doesn’t gives more clues on what’s failing.

4

Answers


  1. Chosen as BEST ANSWER

    It turned out to be the operating system (I'm using MacOS). In case someone else is facing the same problem you might want to try what helped me.

    The problem was that I had installed mysql and apache from my terminal. This caused that XAMPP wasn't able to initialize properly and didn't share the proper ports, therefore, my Laravel application could never find the right database. So I uninstalled both mysql, apache and I reinstalled XAMPP (version 7.4.5).

    After that, everything worked properly.


  2. Another Issue could be that your configurations are already cached and saved in /bootstrap/cache/config.php file. You just need to delete this file and your problem is sorted.
    if you want them to be cached again then run

    php artisan config:cache
    

    command

    Login or Signup to reply.
  3. In my case,

    • step 1: clear logs from laravel.log
    • step 2: php artisan optimize
    • step 3: php artisan migrate
    Login or Signup to reply.
  4. Try this,

    • Step 1: clear logs from laravel.log
    • Step 2: php artisan optimize
    • Step 3: php artisan migrate

    This command will clear all kinds of cache at once. :

    $ php artisan optimize:clear
    

    This is an alias of :

    $ php artisan view:clear
    $ php artisan config:clear
    $ php artisan route:clear
    $ php artisan cache:clear
    $ php artisan clear-compiled
    

    Is it possible to use the code below with the new clear cache commands:

    //Clear Cache facade value:
    Route::get('/clear-cache', function() {
        $exitCode = Artisan::call('cache:clear');
        return '<h1>Cache facade value cleared</h1>';
    });
    
    //Reoptimized class loader:
    Route::get('/optimize', function() {
        $exitCode = Artisan::call('optimize');
        return '<h1>Reoptimized class loader</h1>';
    });
    
    //Route cache:
    Route::get('/route-cache', function() {
        $exitCode = Artisan::call('route:cache');
        return '<h1>Routes cached</h1>';
    });
    
    //Clear Route cache:
    Route::get('/route-clear', function() {
        $exitCode = Artisan::call('route:clear');
        return '<h1>Route cache cleared</h1>';
    });
    
    //Clear View cache:
    Route::get('/view-clear', function() {
        $exitCode = Artisan::call('view:clear');
        return '<h1>View cache cleared</h1>';
    });
    
    //Clear Config cache:
    Route::get('/config-cache', function() {
        $exitCode = Artisan::call('config:cache');
        return '<h1>Clear Config cleared</h1>';
    });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search