0

我在共享主机中使用来自 phpmyadmin 的以下脚本:

USE newmakerting
CREATE TABLE `nemarketing_registration`.`users` (

`id` INT NOT NULL AUTO_INCREMENT ,
`email` VARCHAR( 256 ) ,
`firstName` VARCHAR( 256 ) ,
`lastName` VARCHAR( 256 ) ,
`profession` VARCHAR( 256 ) ,
`company` VARCHAR( 256 ) ,
`country` VARCHAR( 256 ) ,
`ticketNumber` VARCHAR( 256 ) ,
`jobArea` VARCHAR( 256 ) ,
`networkingPeople` VARCHAR( 256 ) ,
`topics_networking` VARCHAR( 256 ) ,
`topics_research` VARCHAR( 256 ) ,
`topics_tochat` VARCHAR( 256 ) ,
`last_book` VARCHAR( 256 ) ,
 PRIMARY KEY ( `id` ) 
 ) CHARACTER SET utf8;

但我收到以下错误:

# 1064 - You have an error in your SQL syntax; check the handbook That corresponds

to your MySQL server version for the right syntax to use near 'CREATE TABLE `` 

nemarketing_registration. `Users` (`id` INT NOT NULL AUTO_INC 'at line 2 
4

2 回答 2

0

后加分隔符USE newmakerting,试试

USE newmakerting;         -- << this one

CREATE TABLE `nemarketing_registration`.`users` 
(
`id` INT NOT NULL AUTO_INCREMENT ,
`email` VARCHAR( 256 ) ,
`firstName` VARCHAR( 256 ) ,
`lastName` VARCHAR( 256 ) ,
`profession` VARCHAR( 256 ) ,
`company` VARCHAR( 256 ) ,
`country` VARCHAR( 256 ) ,
`ticketNumber` VARCHAR( 256 ) ,
`jobArea` VARCHAR( 256 ) ,
`networkingPeople` VARCHAR( 256 ) ,
`topics_networking` VARCHAR( 256 ) ,
`topics_research` VARCHAR( 256 ) ,
`topics_tochat` VARCHAR( 256 ) ,
`last_book` VARCHAR( 256 ) ,
 PRIMARY KEY ( `id` ) 
 ) CHARACTER SET utf8;
于 2012-11-09T06:37:24.007 回答
0
Please change as per below :
1) "USE newmakerting" => "USE newmakerting;"
   Here semicolon is missing.
2) "CREATE TABLE `nemarketing_registration`.`users`"  =>
    "CREATE TABLE `newmakerting`.`users`"
    Here database name is wrong .
ex:
USE newmakerting;
CREATE TABLE `newmakerting`.`users` (
`id` INT NOT NULL AUTO_INCREMENT ,
`email` VARCHAR( 256 ) ,
`firstName` VARCHAR( 256 ) ,
`lastName` VARCHAR( 256 ) ,
`profession` VARCHAR( 256 ) ,
`company` VARCHAR( 256 ) ,
`country` VARCHAR( 256 ) ,
`ticketNumber` VARCHAR( 256 ) ,
`jobArea` VARCHAR( 256 ) ,
`networkingPeople` VARCHAR( 256 ) ,
`topics_networking` VARCHAR( 256 ) ,
`topics_research` VARCHAR( 256 ) ,
`topics_tochat` VARCHAR( 256 ) ,
`last_book` VARCHAR( 256 ) ,
 PRIMARY KEY ( `id` ) 
 ) CHARACTER SET utf8;
于 2012-11-09T06:46:27.943 回答