title: what is the correct syntax for executing .sql script in MySQL command line?
body: <p>I am confused. From references I have seen online, the command to execute a text file script is this:</p>
  
  <pre><code>mysql&gt; --user=root --password=admin --database=zero &lt;query.sql
  </code></pre>
  
  <p>However when I ran this, the command line said theres an error with mySQL syntax (error 1064).
  I saved the query.sql script file within the C:program files...\MYSQL\MYSQL Server5.1.. (whichever folder directory that contains the mySQL command line terminal .exe) </p>
  
  <p>I then did this:</p>
  
  <pre><code> mysql&gt; USE db1 \g
   mysql&gt; source &lt;query.sql \g
  </code></pre>
  
  <p>It also doesnt work; command line gave me the same error. mySQL version I have is different than other versions I have seen. As you can see, you have to add '\g' at the end of every query.</p>
  
  <p>Please help, and let me know if the description is not very clear..thx</p>
  
  <p>EDITED:
  So this is the code I have inside the query.sql:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS 'db1'(
  'id' int(255) NOT NULL auto_increment,
  'date' date NOT NULL,
  'title' varchar(255) NOT NULL,
  'introtext' text NOT NULL,
  'maintext' text NOT NULL,
  PRIMARY KEY ('id')
  )
  </code></pre>