title: SQLSTATE[42S02]: Base table or view not found: 1146 Table X doesn't exist
body: <p>I am getting this error in Laravel 5:</p>
  
  <blockquote>
    <p>SQLSTATE[42S02]: Base table or view not found: 1146 Table 'intern.users' doesn't exist (SQL: select * from users where username = admin limit 1)</p>
  </blockquote>
  
  <p>config/database.php</p>
  
  <pre><code>        'mysql' =&gt; [
      'driver'    =&gt; 'mysql',
      'host'      =&gt; 'localhost',
      'database'  =&gt; 'intern',
      'username'  =&gt; 'root',
      'password'  =&gt; '',
      'charset'   =&gt; 'utf8',
      'collation' =&gt; 'utf8_unicode_ci',
      'prefix'    =&gt; '',
      'strict'    =&gt; false,
  ],
  </code></pre>
  
  <p>The function admin is called for admin page, and database table is mentioned in it as admin because there are many tables in it.</p>
  
  <pre><code>    public function admin(Request $request){
  
             if($request-&gt;isMethod('get')){
             return \View::make('student.admin');
          } else
      {
  
  
          $check=0;
          $check=\DB::table('admin')-&gt;get();
          $username = Input::get('username');
          $password = Input::get('password');
  
  
  
       $data=array(
       'username'=&gt;$request-&gt;get('username'),
       'password'=&gt;$request-&gt;get('password')
      );
  
      if(\Auth::attempt($data))
      {
          return redirect::intended('student/index');
      }
      else
      {
          return redirect('student/admin');
      }
  
  
          }   
  
  
  
         }    
  </code></pre>
  
  <p>Form is here:</p>
  
  <pre><code>  &lt;div id="pageContent"&gt;&lt;br /&gt;
  &lt;div align="left" style="margin-left:24px;"&gt;
    &lt;h2&gt;Please Log In To Manage&lt;/h2&gt;
    {!! Form::open(array('url' =&gt; '/admin')) !!}
    &lt;input type="hidden" name="_token" value="{{ csrf_token() }}"&gt;
  
  
      User Name:&lt;br /&gt;
        &lt;input name="username" type="text" id="username" size="40" /&gt;
      &lt;br /&gt;&lt;br /&gt;
      Password:&lt;br /&gt;
     &lt;input name="password" type="password" id="password" size="40" /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
  
       &lt;input type="submit" name="button" id="button" value="Log In" /&gt;
  
  
   {!! Form::close() !!}
  </code></pre>