1

mysql で source コマンドを使用して mysql ワークベンチから create スクリプトをインポートする際に問題が発生しています。

PhpMYAdminのSQLボックスに貼り付けるとエクスポートは正常に機能しますが、ubuntuのmysqlでソースを使用すると機能しているように見えますが、テーブルはありません。

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';

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

-- -----------------------------------------------------
-- Table `techforceapp`.`techs`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `techforceapp`.`techs` ;

CREATE  TABLE IF NOT EXISTS `techforceapp`.`techs` (
  `idtechs` INT NOT NULL AUTO_INCREMENT ,
  `firstname` VARCHAR(45) NULL ,
  `lastname` VARCHAR(45) NULL ,
  `address` VARCHAR(45) NULL ,
  `city` VARCHAR(45) NULL ,
  `state` VARCHAR(45) NULL ,
  `zip` VARCHAR(45) NULL ,
  `phone` VARCHAR(45) NULL ,
  `email` VARCHAR(45) NULL ,
  `sms` VARCHAR(45) NULL ,
  `password` VARCHAR(45) NULL ,
  `twitter` VARCHAR(45) NULL ,
  `facebook` VARCHAR(45) NULL ,
  `linkedin` VARCHAR(45) NULL ,
  `dateadded` TIMESTAMP NULL DEFAULT now() ,
  `enddate` DATETIME NULL ,
  `paylevel1` FLOAT NULL ,
  `paylevel2` FLOAT NULL ,
  `paylevel3` FLOAT NULL ,
  `admin` INT NULL ,
  PRIMARY KEY (`idtechs`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `techforceapp`.`customers`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `techforceapp`.`customers` ;

CREATE  TABLE IF NOT EXISTS `techforceapp`.`customers` (
  `idcustomers` INT NOT NULL AUTO_INCREMENT ,
  `firstname` VARCHAR(45) NULL ,
  `lastname` VARCHAR(45) NULL ,
  `address` VARCHAR(45) NULL ,
  `city` VARCHAR(45) NULL ,
  `state` VARCHAR(45) NULL ,
  `zip` VARCHAR(45) NULL ,
  `phone1` VARCHAR(45) NULL ,
  `email` VARCHAR(45) NULL ,
  `phone2` VARCHAR(45) NULL ,
  `referral` VARCHAR(45) NULL ,
  `discount` INT NULL ,
  `sms` VARCHAR(45) NULL ,
  `password` VARCHAR(45) NULL ,
  `twitter` VARCHAR(255) NULL ,
  `facebook` VARCHAR(255) NULL ,
  `linkedin` VARCHAR(255) NULL ,
  `dateadded` TIMESTAMP NULL DEFAULT now() ,
  `role` VARCHAR(45) NULL ,
  `notes` TEXT NULL ,
  PRIMARY KEY (`idcustomers`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `techforceapp`.`status`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `techforceapp`.`status` ;

CREATE  TABLE IF NOT EXISTS `techforceapp`.`status` (
  `idstatus` INT NOT NULL AUTO_INCREMENT ,
  `status` VARCHAR(45) NULL ,
  PRIMARY KEY (`idstatus`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `techforceapp`.`jobs`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `techforceapp`.`jobs` ;

CREATE  TABLE IF NOT EXISTS `techforceapp`.`jobs` (
  `idjobs` INT NOT NULL AUTO_INCREMENT ,
  `customers_idcustomers` INT NOT NULL ,
  `invoiceprice` FLOAT NULL ,
  `discount` INT NULL ,
  `milage` INT NULL ,
  `locations_idlocations` INT NULL ,
  `redo` VARCHAR(45) NULL ,
  `redojobid` VARCHAR(45) NULL ,
  `date` DATETIME NULL ,
  `dateadded` TIMESTAMP NULL DEFAULT now() ,
  `assignedtechid` INT NULL DEFAULT 0 ,
  `description` TEXT NULL ,
  `nextaction` VARCHAR(255) NULL ,
  `nextactiondate` DATETIME NULL ,
  `status_idstatus` INT NOT NULL ,
  `taxes` FLOAT NULL ,
  `quotedamount` FLOAT NULL ,
  PRIMARY KEY (`idjobs`) ,
  INDEX `fk_jobs_customers` (`customers_idcustomers` ASC) ,
  INDEX `fk_jobs_status1` (`status_idstatus` ASC) ,
  CONSTRAINT `fk_jobs_customers`
    FOREIGN KEY (`customers_idcustomers` )
    REFERENCES `techforceapp`.`customers` (`idcustomers` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_jobs_status1`
    FOREIGN KEY (`status_idstatus` )
    REFERENCES `techforceapp`.`status` (`idstatus` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `techforceapp`.`devices`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `techforceapp`.`devices` ;

CREATE  TABLE IF NOT EXISTS `techforceapp`.`devices` (
  `iddevices` INT NOT NULL AUTO_INCREMENT ,
  `type` VARCHAR(45) NULL ,
  `os` VARCHAR(45) NULL ,
  `serial` VARCHAR(45) NULL ,
  `notes` TEXT NULL ,
  `customers_idcustomers` INT NOT NULL ,
  PRIMARY KEY (`iddevices`) ,
  INDEX `fk_devices_customers1` (`customers_idcustomers` ASC) ,
  CONSTRAINT `fk_devices_customers1`
    FOREIGN KEY (`customers_idcustomers` )
    REFERENCES `techforceapp`.`customers` (`idcustomers` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `techforceapp`.`accessories`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `techforceapp`.`accessories` ;

CREATE  TABLE IF NOT EXISTS `techforceapp`.`accessories` (
  `idaccessories` INT NOT NULL AUTO_INCREMENT ,
  `description` VARCHAR(140) NULL ,
  `quantity` INT NULL ,
  `jobs_idjobs` INT NOT NULL ,
  `devices_iddevices` INT NULL ,
  PRIMARY KEY (`idaccessories`) ,
  INDEX `fk_accessories_jobs1` (`jobs_idjobs` ASC) ,
  CONSTRAINT `fk_accessories_jobs1`
    FOREIGN KEY (`jobs_idjobs` )
    REFERENCES `techforceapp`.`jobs` (`idjobs` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `techforceapp`.`lineitems`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `techforceapp`.`lineitems` ;

CREATE  TABLE IF NOT EXISTS `techforceapp`.`lineitems` (
  `idlineitems` INT NOT NULL AUTO_INCREMENT ,
  `jobs_idjobs` INT NOT NULL ,
  `type` VARCHAR(45) NULL ,
  `price` FLOAT NULL ,
  `tax` FLOAT NULL ,
  `description` VARCHAR(140) NULL ,
  PRIMARY KEY (`idlineitems`) ,
  INDEX `fk_lineitems_jobs1` (`jobs_idjobs` ASC) ,
  CONSTRAINT `fk_lineitems_jobs1`
    FOREIGN KEY (`jobs_idjobs` )
    REFERENCES `techforceapp`.`jobs` (`idjobs` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `techforceapp`.`joblogs`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `techforceapp`.`joblogs` ;

CREATE  TABLE IF NOT EXISTS `techforceapp`.`joblogs` (
  `idjoblogs` INT NOT NULL AUTO_INCREMENT ,
  `text` TEXT NULL ,
  `jobs_idjobs` INT NOT NULL ,
  `techs_idtechs` INT NOT NULL ,
  `entrydate` TIMESTAMP NULL DEFAULT now() ,
  `techtime` VARCHAR(45) NULL ,
  PRIMARY KEY (`idjoblogs`) ,
  INDEX `fk_joblogs_jobs1` (`jobs_idjobs` ASC) ,
  INDEX `fk_joblogs_techs1` (`techs_idtechs` ASC) ,
  CONSTRAINT `fk_joblogs_jobs1`
    FOREIGN KEY (`jobs_idjobs` )
    REFERENCES `techforceapp`.`jobs` (`idjobs` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_joblogs_techs1`
    FOREIGN KEY (`techs_idtechs` )
    REFERENCES `techforceapp`.`techs` (`idtechs` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `techforceapp`.`locations`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `techforceapp`.`locations` ;

CREATE  TABLE IF NOT EXISTS `techforceapp`.`locations` (
  `idlocations` INT NOT NULL AUTO_INCREMENT ,
  `customers_idcustomers` INT NOT NULL ,
  `address` VARCHAR(45) NULL ,
  `city` VARCHAR(45) NULL ,
  `state` VARCHAR(45) NULL ,
  `zip` VARCHAR(45) NULL ,
  `notes` TEXT NULL ,
  `phone` VARCHAR(45) NULL ,
  PRIMARY KEY (`idlocations`) ,
  INDEX `fk_locations_customers1` (`customers_idcustomers` ASC) ,
  CONSTRAINT `fk_locations_customers1`
    FOREIGN KEY (`customers_idcustomers` )
    REFERENCES `techforceapp`.`customers` (`idcustomers` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `techforceapp`.`bookmarks`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `techforceapp`.`bookmarks` ;

CREATE  TABLE IF NOT EXISTS `techforceapp`.`bookmarks` (
  `idbookmarks` INT NOT NULL AUTO_INCREMENT ,
  `description` VARCHAR(50) NULL ,
  `url` VARCHAR(255) NULL ,
  PRIMARY KEY (`idbookmarks`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `techforceapp`.`company`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `techforceapp`.`company` ;

CREATE  TABLE IF NOT EXISTS `techforceapp`.`company` (
  `idcompany` INT NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(45) NULL ,
  `address` VARCHAR(45) NULL ,
  `city` VARCHAR(45) NULL ,
  `state` VARCHAR(45) NULL ,
  `zip` VARCHAR(45) NULL ,
  `phone` VARCHAR(45) NULL ,
  `email` VARCHAR(45) NULL ,
  `website` VARCHAR(45) NULL ,
  PRIMARY KEY (`idcompany`) )
ENGINE = InnoDB;


-- -----------------------------------------------------
-- Table `techforceapp`.`payments`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `techforceapp`.`payments` ;

CREATE  TABLE IF NOT EXISTS `techforceapp`.`payments` (
  `idpayments` INT NOT NULL AUTO_INCREMENT ,
  `type` VARCHAR(45) NULL ,
  `amount` FLOAT NULL ,
  `jobs_idjobs` INT NOT NULL ,
  PRIMARY KEY (`idpayments`) ,
  INDEX `fk_payments_jobs1` (`jobs_idjobs` ASC) ,
  CONSTRAINT `fk_payments_jobs1`
    FOREIGN KEY (`jobs_idjobs` )
    REFERENCES `techforceapp`.`jobs` (`idjobs` )
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB;



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

-- -----------------------------------------------------
-- Data for table `techforceapp`.`techs`
-- -----------------------------------------------------
START TRANSACTION;
USE `techforceapp`;
INSERT INTO `techforceapp`.`techs` (`idtechs`, `firstname`, `lastname`, `address`, `city`, `state`, `zip`, `phone`, `email`, `sms`, `password`, `twitter`, `facebook`, `linkedin`, `dateadded`, `enddate`, `paylevel1`, `paylevel2`, `paylevel3`, `admin`) VALUES (0, 'Admin', 'Admin', '', '', '', '', '', 'admin', NULL, '$1$TdrF#$WPr2kmoMgPunETRV0KMtA0', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);

COMMIT;

-- -----------------------------------------------------
-- Data for table `techforceapp`.`status`
-- -----------------------------------------------------
START TRANSACTION;
USE `techforceapp`;
INSERT INTO `techforceapp`.`status` (`idstatus`, `status`) VALUES (1, 'New');
INSERT INTO `techforceapp`.`status` (`idstatus`, `status`) VALUES (2, 'In Progress');
INSERT INTO `techforceapp`.`status` (`idstatus`, `status`) VALUES (8, 'Waiting For Customer Info');
INSERT INTO `techforceapp`.`status` (`idstatus`, `status`) VALUES (4, 'Waiting For Parts');
INSERT INTO `techforceapp`.`status` (`idstatus`, `status`) VALUES (5, 'Waiting For Spot On Bench');
INSERT INTO `techforceapp`.`status` (`idstatus`, `status`) VALUES (6, 'Waiting For Payment');
INSERT INTO `techforceapp`.`status` (`idstatus`, `status`) VALUES (7, 'Waiting For Pickup');
INSERT INTO `techforceapp`.`status` (`idstatus`, `status`) VALUES (3, 'Completed');

COMMIT;

-- -----------------------------------------------------
-- Data for table `techforceapp`.`company`
-- -----------------------------------------------------
START TRANSACTION;
USE `techforceapp`;
INSERT INTO `techforceapp`.`company` (`idcompany`, `name`, `address`, `city`, `state`, `zip`, `phone`, `email`, `website`) VALUES (0, 'PC Repair Place', '1 Yemen St', 'Yemen', 'MI', '48195', '555-555-1234', 'us@pc.com', 'www.wefixcomputers.com');

COMMIT;

ここに画像の説明を入力

何か案は?

4

1 に答える 1

0

スクリーン キャプチャは、(SHOW TABLES ステートメントの前に) 5 つのステートメントが実行されたように見えます。これは、上記のスクリプトを実行した場合に予想されるよりもはるかに少ない行です。

その init.sql スクリプトの内容を確認してください。

試す:

SELECT * FROM information_schema.tables WHERE table_schema = 'techforceapp' ;

また

SELECT * FROM information_schema.tables WHERE table_name = 'customers';

sql_mode は何に設定されていますか? 現在のデータベースは何ですか?

SELECT @@sql_mode ;
SELECT DATABASE() ;
于 2012-07-12T16:14:08.237 に答える