- 论坛徽章:
- 0
|
本帖最后由 cenalulu 于 2012-11-05 13:16 编辑
#add by cenalulu: 解决方案见14楼
我在导入某参考书上的示例代码程序<php & mysql web数据库应用开发指南>这本书,winestore.data
mysql -u root -p < /tmp/winestore.data
输入密码后提示以下提示:
[root@yzw ~]# mysql -uroot -pusayzwhate < /tmp/winestore.data
ERROR 1064 (42000) at line 21: 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 'type=MyISAM' at line 8
我看了一下该示例代码文件内容:
8 ## Lane, "Web Database Application with PHP and MySQL" published by O'Reil ly &
9 ## Associates.
10 ##
11 ## This code is under copyright and cannot be included in any other book,
12 ## publication, or educational product without permission from O'Reilly &
13 ## Associates. No warranty is attached; we cannot take responsibility for errors
14 ## or fitness for use.
15
16 # Note: The "if exists" which only works with MySQL 3.22 or later
17 drop database if exists winestore;
18 create database winestore;
19 use winestore;
20
21 CREATE TABLE users (
22 cust_id int(5) NOT NULL,
23 user_name varchar(50) NOT NULL,
24 password varchar(32) NOT NULL,
25 PRIMARY KEY (user_name),
26 KEY password (password),
27 KEY cust_id (cust_id)
28 ) type=MyISAM;
29
30 CREATE TABLE customer (
31 cust_id int(5) NOT NULL,
32 surname varchar(50),
33 firstname varchar(50),
34 initial char(1),
35 title_id int(3),
36 address varchar(50),
37 city varchar(50),
38 state varchar(20),
39 zipcode varchar(10),
40 country_id int(4),
41 phone varchar(15),
42 birth_date char(10),
43 PRIMARY KEY (cust_id)
44 ) type=MyISAM;
我的mysql数据库版本是:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.27-log MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
出现这样的问题,是不是和我的数据库版本太高有关系吗?怎么解决呢。 |
|