Search code examples
mysqlsqlmysql-error-1064

MySQL ERROR 1064 in line, but don't know what is wrong?


I've got the following line I want to execute in MySQL:

CREATE TABLE 'virtual_domains' (
    'id' int(11) NOT NULL auto_increment,
    'name' varchar(50) NOT NULL,
     PRIMARY KEY ('id'))
ENGINE=InnoDB DEFAULT CHARSET=utf8;  

However, it gave me this error:

ERROR 1064 (42000): 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 ''virtual_domains' ('id' int(11) NOT NULL auto_increment, 'name' varchar(50) NOT ' at line 1

What am I missing here??

Thanks for the help!

Rob


Solution

  • remove the single quotes around the table and column names. use backticks instead.

    CREATE TABLE `virtual_domains` (
        `id` int(11) NOT NULL auto_increment,
        `name` varchar(50) NOT NULL,
         PRIMARY KEY (`id`))
    ENGINE=InnoDB DEFAULT CHARSET=utf8;