I'm using MySQL Workbench 6.2 [Windows7] and I want to create a script with all my steps. Among the steps, I have a series of .sql files stored from on my computer that create and populate tables. I want to run these files from the query tab but every time I use this command:
source C:/Users/[username]/Desktop/sampdb/create_president.sql;
I get an Error 1064, which says
"Error Code: 1064. 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> source C:/Users/[username]/Desktop/sampdb/create_president.sql at line 1 "
Can anyone tell me what I'm doing wrong? How can I refer to a .sql file within a MySQL Workbench script?
What code should I use in the MySQL Workbench instead of source
? I have tried LOAD DATA LOCAL INFILE 'C:/Users/[username]/Desktop/sampdb/create_president.sql';
but it didn't work either. Any idea what can be wrong?
*Just for additional information, create_president.sql contains the following code:
DROP TABLE IF EXISTS president;
#@ _CREATE_TABLE_
CREATE TABLE president
(
last_name VARCHAR(15) NOT NULL,
first_name VARCHAR(15) NOT NULL,
suffix VARCHAR(5) NULL,
city VARCHAR(20) NOT NULL,
state VARCHAR(2) NOT NULL,
birth DATE NOT NULL,
death DATE NULL
);