Home > Enterprise >  When I run " php artisan migrate " in my project the following error occurs, How can I sol
When I run " php artisan migrate " in my project the following error occurs, How can I sol

Time:08-03

When I run " php artisan migrate " in my project the following error occurs, How can I solve the error?

Illuminate\Database\QueryException
   
could not find driver (SQL: select * from information_schema.tables where table_schema = tc_cse-infohub and table_name = migrations and table_type = 'BASE TABLE')
    
      at F:\xammp\htdocs\github\TC_CSE-infoHub\vendor\laravel\framework\src\Illuminate\Database\Connection.php:712
        708▕         // If an exception occurs when attempting to run a query, we'll format the error
        709▕         // message to include the bindings with SQL, which will make this exception a
        710▕         // lot more helpful to the developer instead of just the database's errors.
        711▕         catch (Exception $e) {
      ➜ 712▕             throw new QueryException(
        713▕                 $query, $this->prepareBindings($bindings), $e
        714▕             );
        715▕         }
        716▕     }
    ``
      1   F:\xammp\htdocs\github\TC_CSE-infoHub\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70      PDOException::("could not find driver")
  
      2   F:\xammp\htdocs\github\TC_CSE-infoHub\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70      PDO::__construct()
    ```

CodePudding user response:

It could be the wrong mysql port number in your .env file. Check your .env file and make sure the port number matches the same one mysql is using, also the SQL passwords in your env file, because the laravel framework is rejecting the connection hence the error on your screen.

Edit: If you're using windows make sure your php / db extensions are enabled on your xampp / wampp configurations.

For example: ;extension=pdo_mysql.so //uncomment this line just remove ;

after that please try again for php artisan migrate

CodePudding user response:

You should install PDO on your server. Edit your php.ini (look at your phpinfo(), "Loaded Configuration File" line, to find the php.ini file path). Find and uncomment the following line (remove the ; character):

;extension=pdo_mysql.so

After this restart the server and should be good to go.

Edit:

composer update

composer require doctrine/dbal

php artisan cache:clear
php artisan view:clear
php artisan route:clear

Check your .env file

  DB_CONNECTION=mysql
  DB_HOST=127.0.0.1
  DB_PORT=3306
  DB_DATABASE=dbname
  DB_USERNAME=username
  DB_PASSWORD=password

run php -m and see if it lists pdo

  • Related