MySQL Forums
Forum List  »  MySQL Workbench

Troubles with the tables created in Workbench
Posted by: Alyssa Kay
Date: November 19, 2008 11:47PM

Hi everyone,

I've had great success with the Workbench until now.

I have created the database tables using Workbench I'm trying to use the Forward Engineer SQL create script feature to import the tables into my database.

The export feature creates the .sql file successfully, although when i try to use the mysqlimport -u root -p <databasename> <filename>.sql command in the mysql command line client it returns the following error.

mysqlimport: Error: 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 '; IGN
ORE 0 LINES' at line 1, when using table: ;

I am quite new to databases. I'm trying to import is relatively simple only two tables as a test case. I'm not sure what the next step would be to solve this.

If you can help that would be appreciated. Thanks, Alyssa.

This is the .sql file:
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';

CREATE SCHEMA IF NOT EXISTS `db` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `db`;

-- -----------------------------------------------------
-- Table `db`.`table1`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS 'db`.`table1` (
`id` TINYINT(4) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(50) NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;


-- -----------------------------------------------------
-- Table `db`.`table2`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `db`.`table2` (
`id` INT(4) NOT NULL ,
`name` VARCHAR(50) NOT NULL ,
`FK_table1` TINYINT(4) NOT NULL ,
PRIMARY KEY (`id`) ,
INDEX `FK_table1` (`FK_table1` ASC) ,
CONSTRAINT `table2_ibfk_1`
FOREIGN KEY (`FK_table1` )
REFERENCES `db`.`table1` (`id` ))
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;



SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;



Edited 1 time(s). Last edit at 11/20/2008 06:08PM by Alyssa Kay.

Options: ReplyQuote


Subject
Views
Written By
Posted
Troubles with the tables created in Workbench
3322
November 19, 2008 11:47PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.