I can't find what *exactly* the syntax error is in mysql : <p>I am creating a simple database and it's table for learning purpose:</p>

<p>This is my php code(script.php)</p>

<pre><code>&lt;?php

$sql = file_get_contents("init.sql");

$servername = "localhost";
$username = "root";
$password = "";
  // connect to database
$conn = new mysqli($servername, $username, $password);

if ($conn-&gt;connect_error) {
    die("Connection error: " . $conn-&gt;connect_error);
}


 if($conn-&gt;query($sql) == True){
   echo "Database and Table has been created succesfully!";
 }

 else {
   echo "\nError creating database and table:  . $conn-&gt;error";
 }

 ?&gt;
</code></pre>

<p>And this is mysql file(init.mysql)</p>

<pre><code>CREATE DATABASE test;
  USE test;

  CREATE TABLE  Users (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50),
date_of_registration TIMESTAMP)
</code></pre>

<p>The exact error I am seeing is:-</p>

<blockquote>
  <p>Error creating database and table: . You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USE test; CREATE TABLE Users ( id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY ' at line 2</p>
</blockquote>

<p>In my opinion, the code is syntactically correct but as you see I am getting an error
So I am struggling to find <em>where</em> is the error but no luck :(
Or I am blind enough to see it.</p>
