title: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blog.posts' doesn't exist
body: <h2>[Heading][1] ##Laravel 5.8</h2>
  
  <p>This is the weblog with Laravel</p>
  
  <p>I'm setting up a database and  create the table when i run the program, the program  has warning:</p>
  
  <strong>SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blog.posts' doesn't exist (SQL: insert into `posts` (`title`, `content`, `updated_at`, `created_at`) values (asdasdasdas, This blog post will get you right on track with laravel, 2019-04-08 14:54:16, 2019-04-08 14:54:16))</strong>
  
  <p>config/database.php</p>
  
  <pre><code>    'mysql' =&gt; [
          'driver' =&gt; 'mysql',
          'host' =&gt; env('DB_HOST', '127.0.0.1'),
          'port' =&gt; env('DB_PORT', '3306'),
          'database' =&gt; env('DB_DATABASE', 'forge'),
          'username' =&gt; env('DB_USERNAME', 'forge'),
          'password' =&gt; env('DB_PASSWORD', ''),
          'unix_socket' =&gt; env('DB_SOCKET', ''),
          'charset' =&gt; 'utf8mb4',
          'collation' =&gt; 'utf8mb4_unicode_ci',
          'prefix' =&gt; '',
          'prefix_indexes' =&gt; true,
          'strict' =&gt; true,
          'engine' =&gt; null,
          'options' =&gt; extension_loaded('pdo_mysql') ? array_filter([
              PDO::MYSQL_ATTR_SSL_CA =&gt; env('MYSQL_ATTR_SSL_CA'),
          ]) : [],
      ];
  </code></pre>
  
  <p>2019_04_01_135051_create_posts_table</p>
  
  <pre><code>public function up()
  {
      Schema::create('posts', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;timestamps();
          $table-&gt;string('title');
          $table-&gt;text('content');
      });
  }
  </code></pre>
  
  <p>2019_04_01_134543_create_likes_table</p>
  
  <pre><code> public function up()
  {
      Schema::create('likes', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;timestamps();
      });
  }
  </code></pre>
  
  <p>2019_04_01_134543_create_tags_table</p>
  
  <pre><code>  public function up()
  {
      Schema::create('tags', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;timestamps();
          $table-&gt;string('name');
      });
  }
  </code></pre>
  
  <p>this line is in the Post class : </p>
  
  <pre><code> protected $fillable = ['title', 'content'];
  </code></pre>
  
  <p>this line is in postControoler.php</p>
  
  <pre><code>  public function postAdminCreate(Store $session, Request $request)
  {
      $this-&gt;validate($request, [
          'title' =&gt; 'required|min:5',
          'content' =&gt; 'required|min:10'
      ]);
      $post = new Post([
          'title' =&gt; $request-&gt;input('title'),
          'content' =&gt; $request-&gt;input('content')
      ]);
      $post-&gt;save();
  
      return redirect()-&gt;route('admin.index')-&gt;with('info', 'Post created, Title is: ' . $request-&gt;input('title'));
  }
  </code></pre>
  
  <p>2014_10_12_000000_create_users_table</p>
  
  <pre><code>&lt;?php
  
  use Illuminate\Support\Facades\Schema;
  use Illuminate\Database\Schema\Blueprint;
  use Illuminate\Database\Migrations\Migration;
  
  class CreateUsersTable extends Migration
  {
  /**
   * Run the migrations.
   *
   * @return void
   */
  public function up()
  {
      Schema::create('users', function (Blueprint $table) {
          $table-&gt;bigIncrements('id');
          $table-&gt;string('title');
          $table-&gt;string('content');
          $table-&gt;string('email')-&gt;unique();
          $table-&gt;timestamp('email_verified_at')-&gt;nullable();
          $table-&gt;string('password');
          $table-&gt;rememberToken();
          $table-&gt;timestamps();
      });
  }
  
  /**
   * Reverse the migrations.
   *
   * @return void
   */
  public function down()
  {
      Schema::dropIfExists('users');
  }
  }
  </code></pre>
  
  <p>this is the post.blade.php in blog folder</p>
  
  <pre><code>@extends('layouts.master')
  
  @section('content')
  &lt;div class="row"&gt;
      &lt;div class="col-md-12"&gt;
          &lt;p class="quote"&gt;{{ $post['title']  }}&lt;/p&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="row"&gt;
      &lt;div class="col-md-12"&gt;
          &lt;p&gt;{{ $post['content'] }}&lt;/p&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  @endsection
  </code></pre>
  
  <p>First I run the     </p>
  
  <pre><code>php artisan migrate
  </code></pre>
  
  <p>the cmd say :</p>
  
  <pre><code> Migrating: 2014_10_12_000000_create_users_table
  
      Illuminate\Database\QueryException  : SQLSTATE[42S01]: Base table or view 
      already exists: 1050 Table 'users' already exists (SQL: create table `users` 
      (`id` bigint unsigned not null auto_increment primary key, `title` 
      varchar(255) not null, `content` varchar(255) not null, `email` varchar(255) 
      not null, `email_verified_at` timestamp null, `password` varchar(255) not 
      null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
  
    at C:\xampp\htdocs\getting-started\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664
      660|         // If an exception occurs when attempting to run a query, we'll format the error
      661|         // message to include the bindings with SQL, which will make this exception a
      662|         // lot more helpful to the developer instead of just the database's errors.
      663|         catch (Exception $e) {
    &gt; 664|             throw new QueryException(
      665|                 $query, $this-&gt;prepareBindings($bindings), $e
      666|             );
      667|         }
      668|
  
    Exception trace:
  
    1   PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists")
        C:\xampp\htdocs\getting-started\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458
  
    2   PDOStatement::execute()
        C:\xampp\htdocs\getting-started\vendor\laravel\framework\src\Illuminate\Database\Connection.php:458
  </code></pre>
  
  <p>When i create post and click submit say warning</p>
  
  <p>How can i fix it?</p>
  
  <strong>SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blog.posts' doesn't exist (SQL: insert into `posts` (`title`, `content`, `updated_at`, `created_at`) values (asdasdasdas, This blog post will get you right on track with laravel, 2019-04-08 14:54:16, 2019-04-08 14:54:16))</strong>
  
  
  
  
  
  
  
  yellow"><strong>SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blog.posts' doesn't exist (SQL: insert into `posts` (`title`, `content`, `updated_at`, `created_at`) values (asdasdasdas, This blog post will get you right on track with laravel, 2019-04-08 14:54:16, 2019-04-08 14:54:16))</strong>