Matt Westlake
Matt Westlake

Reputation: 3651

sql create table not working

Trying to migrate this table into the database on my server and I keep getting the error 1146 project.users does not exist. can anyone see why?

 CREATE TABLE IF NOT EXISTS `project`.`users` (
      `username` VARCHAR(50) NOT NULL ,
      `password` VARCHAR(50) NOT NULL ,
      `enabled` BIT(1) NOT NULL ,
      PRIMARY KEY (`username`) )
    ENGINE = InnoDB
    DEFAULT CHARACTER SET = latin1

Upvotes: 0

Views: 3651

Answers (1)

povilasp
povilasp

Reputation: 2396

So I've put this in a fiddle slightly modified:

http://sqlfiddle.com/#!2/287ac/1

CREATE TABLE IF NOT EXISTS `users` (
  `username` VARCHAR(50) NOT NULL ,
  `password` VARCHAR(50) NOT NULL ,
  `enabled` BIT(1) NOT NULL ,
  PRIMARY KEY (`username`) )
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1

And it works as expected.

Try making sure you have "project" database, or change the name project to the one you're migrating to.

Upvotes: 1

Related Questions