免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1449 | 回复: 1
打印 上一主题 下一主题

Import错误 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-10-20 11:55 |只看该作者 |倒序浏览
shelter.sql文件如下,我想把它导入到MySQL中去,工具是phpMyAdmin

/////////////////////////////////////////////////////////////////////////////////////////////////////////
-- shelter.sql
-- MySQL dump 9.11
--
-- Host: localhost    Database: Shelter
-- ------------------------------------------------------
-- Server version        4.0.23-standard-log

---
--- Create the database
---

DROP DATABASE IF EXISTS Shelter;

CREATE DATABASE Shelter;

USE Shelter;

--
-- Table structure for table `tCat`
--


DROP TABLE IF EXISTS tCat;
CREATE TABLE tCat (
  CatID int(11) NOT NULL auto_increment,
  Name varchar(40) NOT NULL default '',
  Gender char(1) NOT NULL default 'U',
  Age int(3) NOT NULL default '0',
  Breed varchar(100) NOT NULL default '',
  PRIMARY KEY  (CatID)
) TYPE=MyISAM;

--
-- Dumping data for table `tCat`
--

INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (1,'Snowball','M',145,'DSH');
INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (2,'Lizzie','F',141,'DSH/Siamese Mix');
INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (3,'Pim Pim','F',120,'DSH/Russian Blue Mix');
INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (4,'Mathilda','F',37,'DMH');
INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (5,'Manfred','M',18,'DSH');
INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (6,'Saffy','F',108,'DLH');
INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (7,'Tera','F',60,'DSH');
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

但是phpMyAdmin提示如下错误信息:

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
错误
SQL 查询:

-- MySQL dump 9.11
--
-- Host: localhost Database: Shelter
-- ------------------------------------------------------
-- Server version 4.0.23-standard-log
- --
- -- Create the database
- --
DROP DATABASE IF EXISTS Shelter;



MySQL 返回:

#1064 - 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 '---
--- Create the database
---

DROP DATABASE IF EXISTS Shelter' at line 1
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

我看了一下shelter中的语法也没错,不知道问题可能出在什么地方.
我的MySQL版本是5.0

大家帮我看看是什么原因?

[ 本帖最后由 jianjun 于 2006-10-20 11:57 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-10-20 12:59 |只看该作者
想了个办法,成功了.
1.修改shelter.sql
//shelter.sql

CREATE TABLE tCat (
  CatID int(11) NOT NULL auto_increment,
  Name varchar(40) NOT NULL default '',
  Gender char(1) NOT NULL default 'U',
  Age int(3) NOT NULL default '0',
  Breed varchar(100) NOT NULL default '',
  PRIMARY KEY  (CatID)
) TYPE=MyISAM;

--
-- Dumping data for table `tCat`
--

INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (1,'Snowball','M',145,'DSH');
INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (2,'Lizzie','F',141,'DSH/Siamese Mix');
INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (3,'Pim Pim','F',120,'DSH/Russian Blue Mix');
INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (4,'Mathilda','F',37,'DMH');
INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (5,'Manfred','M',18,'DSH');
INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (6,'Saffy','F',108,'DLH');
INSERT INTO tCat (CatID, Name, Gender, Age, Breed) VALUES (7,'Tera','F',60,'DSH');

/////////////////////////////////////////////////////////////////////////////////////////////////////////////

2.手工建Shelter数据库,然后Improt上面定义的表即可.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP