Composer and php artisan return "SQLSTATE[42S02]: Base table or view not found" for every command.
P粉604848588
2023-07-31 20:27:18
<p>I downloaded my brand project from the git repository and initialized it as usual, but this time under the same conditions I got an error that never happened before: </p>
<pre class="brush:php;toolbar:false;">composer install
In Connection.php line 795:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ibbrdb.boards' doesn't exist (Connection: mysql, SQL: select * from `boards` order by `ordem` asc)
In Connection.php line 416:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ibbrdb.boards' doesn't exist</pre>
<p>My Ibbr app does have a model called Board, but I haven't even migrated the database yet because my first step is to run composer install. I saw some similar questions on stackoverflow where someone suggested running composer dump-autoload before running it and removing post-autoload-dump from composer.json. But none of these methods worked as every composer or php artisan command I ran failed with this error. What could be happening here? </p>
The 'ibbrdb.boards' here opens the database ("ibbrdb" is the name of the database), and then opens the table ("boards" is the name of the table).
Solution 1: You need to change the name of the database to "ibbrdb".
Solution 2: Modify the text in php and change "ibbrdb." to "boards".