Laravel SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name '' Hatası
Merhaba,
Bu hata beni çıldırttı. Araştırdım ne yaptıysam olmadı. Benim sorunuma derman olan bir çözüm bulamadım.
Neyse, sonunda çözdüm ve birgün başta benim sonra da sizin işinize yarayabilir diyerek paylaşıyorum.
Öncelikle benim aldığım hatanın tam hali aşağıdaki gibiydi.
Illuminate\Database\QueryException
SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name '' (SQL: create table `` (`id` int unsigned not null auto_increment primary key, `migration` varchar(191) not null, `batch` int not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
at C:\xampp\htdocs\laravelDersleri\deneme1\vendor\laravel\framework\src\Illuminate\Database\Connection.php:672
668| // If an exception occurs when attempting to run a query, we'll format the error
669| // message to include the bindings with SQL, which will make this exception a
670| // lot more helpful to the developer instead of just the database's errors.
671| catch (Exception $e) {
> 672| throw new QueryException(
673| $query, $this->prepareBindings($bindings), $e
674| );
675| }
676|1 C:\xampp\htdocs\laravelDersleri\deneme1\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458
PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name ''")2 C:\xampp\htdocs\laravelDersleri\deneme1\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458
PDO::prepare("create table `` (`id` int unsigned not null auto_increment primary key, `migration` varchar(191) not null, `batch` int not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci'")
Sıra geldi benim işime yarayan çözüme.
Öncelikle config klasörü içinde bulunan database.php dosyasını açıyoruz.
İçerisinde şöyle bir yer var. Zaten olması gereken de bu.
/* |-------------------------------------------------------------------------- | Migration Repository Table |-------------------------------------------------------------------------- | | This table keeps track of all the migrations2 that have already run for | your application. Using this information, we can determine which of | the migrations2 on disk haven't actually been run in the database. | */ 'migrations' => 'migrations', /*
Ama benimki ise şu şekideydi.
/* |-------------------------------------------------------------------------- | Migration Repository Table |-------------------------------------------------------------------------- | | This table keeps track of all the migrations2 that have already run for | your application. Using this information, we can determine which of | the migrations2 on disk haven't actually been run in the database. | */ 'migrations2' => 'migrations2', /*
Nasıl böyle oldu gerçekten bilmiyorum.
Her neyse, geç de olsa sorunumu çözdüm.
Hepsi bu kadar..
Yorum Yap