juergen d's answer is of course correct; however, considering your error message, you can also add to your SQL file at the beginning line like:
USE your_database_name;
This should also do the job and let you import under the Workbench.
When you are using mysqldump
, the exported file will be saved in the current folder. It doesn't matter under what path it is. Just when importing from command line you need to be at the same folder or specify path to the file. But this isn't the case when you are using visual tool like Workbench, where you need to select the file from folder tree anyway.
There are a few things wrong with the DDL Open Office has generated for you:
- MySQL doesn't have a
VARCHAR_IGNORECASE
datatype
- The
CREATE CACHED TABLE
statement isn't valid
TIMESTAMP(0)
should be TIMESTAMP
The following should work:
CREATE TABLE Users(
UserID NUMERIC(15) NOT NULL PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
MobileNumber VARCHAR(12) NOT NULL,
EmailAddress VARCHAR(50) NOT NULL,
CompanyName VARCHAR(50),
City VARCHAR(50),
StateOrProvince VARCHAR(50),
CountryOrRegion VARCHAR(50),
PostalCode INTEGER,
PassPhraseID NUMERIC(10) NOT NULL,
Gender CHAR(1) NOT NULL,
Age NUMERIC(3) NOT NULL,
MaritalStatus CHAR(10),
Height NUMERIC(4,1),
Weight NUMERIC(3),
Complexion INTEGER,
PreferredMessageMode VARCHAR(10) NOT NULL,
isPaid BOOLEAN NOT NULL,
FBID VARCHAR(50),
BBM VARCHAR(8),
PreferredVerticals VARCHAR(100),
EmergencyNos CHAR(60) NOT NULL,
DOB DATE,
PhotoID INTEGER,
CategoryID NUMERIC(2) NOT NULL,
isActive BOOLEAN NOT NULL,
ActivationDate TIMESTAMP
);
CREATE TABLE UserLocation(
UserID NUMERIC(15) NOT NULL PRIMARY KEY,
Location NUMERIC(22) NOT NULL,
Timestamp TIMESTAMP NOT NULL
);
ALTER TABLE UserLocation
ADD CONSTRAINT FK_UserLocation
FOREIGN KEY (UserID) REFERENCES Users(UserID);
Best Answer
Since you have an ASCII file, the script could be giving problems because it is came from a Windows machine and you are attempting to load it into mysql on a Linux machine.
You may want to try one of two things:
mysql -hIP -r -uroot -p DN_name < filename.sql
mysql -hIP -B -uroot -p DN_name < filename.sql