Artisan migrate could not find driver

前端 未结 11 805
情话喂你
情话喂你 2020-11-27 17:33

I am trying to install Laravel. I have installed Xampp, but when I try to setup my database using php artisan migrateI get the error:

相关标签:
11条回答
  • 2020-11-27 17:52

    Make sure that you've installed php-mysql, the pdo needs php-mysql to operate properly. If not you could simply type

    sudo apt install php-mysql
    
    0 讨论(0)
  • 2020-11-27 17:53

    if you've installed php and mysql in your linux machine, php needs php-mysql extention to communicate with mysql. so make sure you've also installed this extention using:

    sudo yum install php-mysql in redhat based machines.

    and

    sudo apt-get install php-mysql in debian machines.

    0 讨论(0)
  • 2020-11-27 17:56

    We have solved the same error by following the below steps.

    linux command for this type of error occurred then, first of all, check your php.ini file

    If your php.ini file exists then in configuration file simply uncomment the extension:
    
    ;extension=php_pdo_mysql.dll 
    
    Else follow below steps
    
    step1:php -v
    
    step2: Install php mysql extension
    
    php 7.0 sudo apt-get install php7.0-mysql
    
    php 7.1 sudo apt-get install php7.1-mysql
    
    php 7.2 sudo apt-get install php7.2-mysql
    
    php 7.3 sudo apt-get install php7.3-mysql
    
    step3: service apache2 restart
    
    step4: php artisan migrate
    
    0 讨论(0)
  • 2020-11-27 17:57

    If you are matching with sqlite database:
    In your php folder open php.ini file, go to:

    ;extension=pdo_sqlite
    

    Just remove the semicolon and it will work.

    0 讨论(0)
  • 2020-11-27 18:01

    In Windows and PHP 7.4.5 go to php.ini and uncomment this line

    extension=pdo_mysql
    
    0 讨论(0)
  • 2020-11-27 18:06

    I know this is a little late, nevertheless i'm answering this for anyone still experiencing this issue on windows (USING XAMPP).

    Step 1. Verify that there is a mismatch in your PHP version. To do this, open routes/web.php and create a simple route to return the php information like so:

    Route::get('/', function() {
       return response()->json([
        'stuff' => phpinfo()
       ]);
    })
    

    and compare this with output from your command line
    

    As we can see, in my case there is a mismatch, this usually happens if you have multiple versions of php installed.
    

    Step 2. Add the php version being used by your xampp to your system path

    Step 3. Verify that you have the extension enabled in your php.ini file. NB. Make sure you are editing the php.ini file that is shown under the 'loaded configuration file' entry in the results of phpinfo() command.

    0 讨论(0)
提交回复
热议问题