If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Getting error when trying to execute sql script file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-26-09, 17:41
WilliamZunis WilliamZunis is offline
Registered User
 
Join Date: Oct 2009
Posts: 1
Getting error when trying to execute sql script file

I need some help. I've never used MySQL before and am now learning it.
I'm trying to create a table within an existing database:
here is the error:

mysql> use Testing;
Database changed
mysql> select database();
+-----------------+
| database() |
+-----------------+
|Testing|
+-----------------+
1 row in set (0.00 sec)

mysql> < create_info.sql
-> \g
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '< create_info.sql' at line 1
mysql> mysql Testing < create_info.sql;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql Testing < create_info.sql' at line 1
mysql> mysql bbmc_employment < c:\create_info.sql;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'reate_info.sql' at line 1

Here is the SQL script file:

Create Table Info
{
EmailAddress VARCHAR(45) NOT NULL,
PRIMARY KEY (EmailAddress),
Password VARCHAR(15) NOT NULL,
FName VARCHAR(15) NOT NULL,
LName VARCHAR(20) NOT NULL,
Address1 VARCHAR(35) NOT NULL,
Address2 VARCHAR(20) NULL,
City VARCHAR(20) NOT NULL,
State VARCHAR(2) NOT NULL,
ZipCode VARCHAR(10) NOT NULL,
Phone1 VARCHAR(12) NOT NULL,
Phone2 VARCHAR(12) NULL
};


Any ideas...????
Reply With Quote
  #2 (permalink)  
Old 10-26-09, 18:49
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Swap the { and } for ( and ) ?
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 10-26-09, 19:58
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
looks to me like you are trying to pass a shell command to the mysql database

how come you aren't using a tool like the mysql query browser, phpmyadmin, heidisql, sqlyog, navicat... ?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #4 (permalink)  
Old 10-27-09, 18:42
mnirwan mnirwan is offline
Registered User
 
Join Date: Sep 2009
Posts: 64
You need to do it from command line. Here's the command line:

Code:
mysql -u username -p password  -h hostname Testing < create_info.sql
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On