为了账号安全,请及时绑定邮箱和手机立即绑定

为什么建表全部报错了!

为什么建表全部报错了!

PHP
FanlyBaby 2016-09-23 16:31:00
 CREATE DATABASE IF NOT EXISIS 'shopImooc';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 'EXISIS 'shopImooc'' at line 1mysql> USE 'shopImooc';ERROR 1049 (42000): Unknown database 'shopimooc'mysql> --管理员表    -> DROP TABLE IF EXISTS 'imooc_admin';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 '--管 理员表DROP TABLE IF EXISTS 'imooc_admin'' at line 1mysql> CREATE TABLE 'imooc_admin'(    -> 'id' tinyint unsigned auto_increment key,    -> 'username' varchar(20) not null unique,    -> 'password' char(32) not null,    -> 'email' varchar(50) not null    -> )charset=utf8;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 ''imooc_admin'('id' tinyint unsigned auto_increment key,'username' varchar(20) ' at line 1mysql>mysql> --分类表    -> DROP TABLE IF EXISTS 'imooc_cate';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 '--分 类表DROP TABLE IF EXISTS 'imooc_cate'' at line 1mysql> CREATE TABLE 'imooc_cate'(    -> 'id' smallint unsigned auto_increment key,    -> 'cName' varchar(50) unique    -> )charset=utf8;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 ''imooc_cate'('id' smallint unsigned auto_increment key,'cName' varchar(50) uni' at line 1mysql>mysql> --产品表    -> DROP TABLE IF EXISTS 'imooc_pro';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 '--产 品表DROP TABLE IF EXISTS 'imooc_pro'' at line 1mysql> CREATE TABLE 'imooc_pro'(    -> 'id' int unsigned auto_increment key,    -> 'pName' varchar(50) not null unique,    -> 'pSn' varchar(50) not null,    -> 'pNum' int unsigned default 1,    -> 'mPrice' decimal(10,2) not null,    -> 'iPrice' decimal(10,2) not null,    -> 'pDesc' text,    -> 'pImg' varchar(50) not null,    -> 'pubTime' int unsigned not null,    -> 'isShow' tinyint(1) default 1,    -> 'isHot' tinyint(1) default 0,    -> 'cId' smallint unsigned not null    -> )charset=utf8;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 ''imooc_pro'('id' int unsigned auto_increment key,'pName' varchar(50) not null ' at line 1mysql>mysql> --用户表    -> DROP TABLE EXISTS 'imooc_user';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 '--用 户表DROP TABLE EXISTS 'imooc_user'' at line 1mysql> CREATE TABLE 'imooc_user'(    -> 'id' int unsigned auto_increment key,    -> 'username' varchar(20) not null unique,    -> 'password' char(32) not null,    -> 'sex' enum("男","女","保密") not null default "保密",    -> 'face' varchar(50) not null,    -> 'regTime' int unsigned not null    -> )charset=utf8;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 ''imooc_user'('id' int unsigned auto_increment key,'username' varchar(20) not n' at line 1mysql>mysql> --相册表    -> DROP TABLE IF EXISTS 'imooc_album';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 '--相 册表DROP TABLE IF EXISTS 'imooc_album'' at line 1mysql> CREATE TABLE 'imooc_album'(    -> 'id' int unsigned auto_increment key,    -> 'pid' int unsigned not null,    -> 'albumPass' varchar(50) not null    -> )charset=utf8;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 ''imooc_album'('id' int unsigned auto_increment key,'pid' int unsigned not null' at line 1
查看完整描述

3 回答

?
慕粉3612410

TA贡献2条经验 获得超3个赞

应该是包裹数据库名和表名的两个引号写错了,是键盘左上角的那个顿号形式的,不是双引号那个。

查看完整回答
1 反对 回复 2016-09-23
?
leon0204

TA贡献4条经验 获得超0个赞

''     ``

查看完整回答
反对 回复 2016-10-21
  • 3 回答
  • 0 关注
  • 5428 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信