مهدی یار
3 سال پیش توسط مهدی یار مطرح شد
7 پاسخ

مشکل در migrate کردن پروژه

سلام
من هنگام زدن دستور php artisan migrate با ارور زیر مواجه میشم :

   Illuminate\Database\QueryException 

  could not find driver (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:685
    681▕         // If an exception occurs when attempting to run a query, we'll format the error
    682▕         // message to include the bindings with SQL, which will make this exception a
    683▕         // lot more helpful to the developer instead of just the database's errors.
    684▕         catch (Exception $e) {
  ➜ 685▕             throw new QueryException(
    686▕                 $query, $this->prepareBindings($bindings), $e
    687▕             );
    688▕         }
    689▕ 

      +33 vendor frames 
  34  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

ثبت پرسش جدید
نوب
تخصص : کدنویس نوب :)
@yk5742g 3 سال پیش مطرح شد
0

کافیه یه php_info بزنی ببینی که pdo متصل و فعال هست یانه
اگر نبود توی php.ini کافیه ; اول extension=pdo_mysql.so را برداری و apache را ریست کنی
اینم بعدش انجام بده

بستگی به نسخه php

# PHP 7.1
sudo apt install php7.1-mysql

# PHP 7.2:
sudo apt install php7.2-mysql

# PHP 7.3
sudo apt install php7.3-mysql

# PHP 7.4
sudo apt install php7.4-mysql

# PHP 8
sudo apt install php-mysql

نوب
تخصص : کدنویس نوب :)
@yk5742g 3 سال پیش مطرح شد
0

اگر با ویندوز هستی حتما چک کن pdo فعال باشه
اگر با لینوکس هستی باید درایور بانکتو به دیتابیس وصل کنی
بعدش composer update بزن و یه بار هم دستورات زیر را اجرا کن و دوباره تست کن و نتیجه را بگو

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

مهدی یار
@manyam.l.t57 3 سال پیش آپدیت شد
0

سلام ممنون
بله اوبونتو هستم

اگر با لینوکس هستی باید درایور بانکتو به دیتابیس وصل کنی

چطور باید این کار رو انجام بدم ؟

@yk5742g


نوب
تخصص : کدنویس نوب :)
@yk5742g 3 سال پیش مطرح شد
0

کافیه یه php_info بزنی ببینی که pdo متصل و فعال هست یانه
اگر نبود توی php.ini کافیه ; اول extension=pdo_mysql.so را برداری و apache را ریست کنی
اینم بعدش انجام بده

بستگی به نسخه php

# PHP 7.1
sudo apt install php7.1-mysql

# PHP 7.2:
sudo apt install php7.2-mysql

# PHP 7.3
sudo apt install php7.3-mysql

# PHP 7.4
sudo apt install php7.4-mysql

# PHP 8
sudo apt install php-mysql

مهدی یار
@manyam.l.t57 3 سال پیش مطرح شد
0

سلام مجدد
خیلی خیلی ممنونم از شما مشکلم با راه حل شما حل شد !! D:


رضا امیدی
@a.rezaomidi.97 3 سال پیش مطرح شد
0

سلام
خسته نباشید
من تمام مراحل بالا رو انجام دادم ولی باز نشد و به ارور زیر می خورم
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'articles' already exists (SQL: create table articles (id bigint unsigned not null auto_increment primary key, user _id varchar(191) not null, title varchar(191) not null, slug varchar(191) not null, discription text not null, body longtext not null, imageUrl varchar(191) not null, tag v
archar(191) not null, viewcount varchar(191) not null default '0', commentcount varchar(191) not null default '0', created_at timestamp null, updated_at timestamp null) default
character set utf8mb4 collate 'utf8mb4_unicode_ci')

at C:\xampp\htdocs\Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:692
688▕ // If an exception occurs when attempting to run a query, we'll format the error
689▕ // message to include the bindings with SQL, which will make this exception a
690▕ // lot more helpful to the developer instead of just the database's errors.
691▕ catch (Exception $e) {
➜ 692▕ throw new QueryException(
693▕ $query, $this->prepareBindings($bindings), $e
694▕ );
695▕ }
696▕

1 C:\xampp\htdocs\Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:485
PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'articles' already exists")

2 C:\xampp\htdocs\Project\vendor\laravel\framework\src\Illuminate\Database\Connection.php:485
PDOStatement::execute()


سیدعلی موسوی
تخصص : سی شارپ و پی اچ پی
@juza66 3 سال پیش مطرح شد
0

اگر دقت کنی داره اشاره میکنه که جدول مقالات شما از قبل وجود داره!
اگر دیتای مهمی نداری میتونی از اول مایگریت کنید

php artisan migrate:fresh

مهدی‌یار
@m.gh.1385.mahdiyar 2 سال پیش آپدیت شد
0

سلام ، هشت ماه پیش این سوال رو پرسیدم و سیستمم اوبونتو بود و حل شد
الان هم دوباره با همون ارور موقع migrate کردن مواجه شدم روی مانجارو :


Illuminate\\Database\\QueryException

could not find driver (SQL: select \* from informationschema.tables where tableschema = laravel and tablename = migrations and tabletype = 'BASE TABLE')

at vendor/laravel/framework/src/Illuminate/Database/Connection.php:685  
681▕ // If an exception occurs when attempting to run a query, we'll format the error  
682▕ // message to include the bindings with SQL, which will make this exception a  
683▕ // lot more helpful to the developer instead of just the database's errors.  
684▕ catch (Exception $e) {  
➜ 685▕ throw new QueryException(  
686▕ $query, $this->prepareBindings($bindings), $e  
687▕ );  
688▕ }  
689▕

+33 vendor frames

34 artisan:37  
Illuminate\\Foundation\\Console\\Kernel::handle()

ولی الان اصلا extension=pdomysql.so توی php.ini نیست که از کامنت در بیارم ، مشکل کجاست ؟

///////

حل شد ، مشکل وجود ۲ تا php.ini یکی برای php cli و یکی برای xampp بود


برای ارسال پاسخ لازم است وارد شده یا ثبت‌نام کنید

ورود یا ثبت‌نام