用source +文件路径 sql文件的内容是一些创建数据库表的语句,并插入了一些内容。 source F:\sheji\final\dbinit\createtable.sql; 内容如下: drop database if exists xindou;--瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋gb2312 --create database if not exists xindou default character set gb2312; --瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋utf8 create database if not exists xindou default character set utf8;--娴h法鏁ら弫鐗堝祦鎼? use xindou;--閸掑棛琚悰? drop table if exists category; create table if not exists category( id int not null primary key auto_increment, cname varchar(20) not null, parentid int not null default 0, description varchar(200), photo blob, ctype tinyint default 1 ) ENGINE=InnoDB;
你是在MYSQL命令行下还是在WINDOWS的DOS窗口下运行SOURCE?
--瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋gb2312 --create database if not exists xindou default character set gb2312; --瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋utf8 这些语句显然不对。 你的这个 F:\sheji\final\dbinit\createtable.sql; 是哪儿来的?本身就有问题啊。 直接用记事本打开看看内容是什么。
SET NAMES GBK; source F:\sheji\final\dbinit\createtable.sql; 提示什么
我把 createtable.sql文件放在f盘的目录。
createtable.sql文件 是什么软件产生的? 或者是你自己写的?
本帖最后由 ACMAIN_CHM 于 2011-06-07 16:50:17 编辑
这我倒没注意, 是这个样子 --GWAP2.0-閺傛媽鐪寸純鎴濈紦鐞涖劏鍓奸張?--閸掔娀娅庨弫鐗堝祦鎼存挸绨眡indou drop database if exists xindou;--瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋gb2312 --create database if not exists xindou default character set gb2312; --瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋utf8 create database if not exists xindou default character set utf8;--娴h法鏁ら弫鐗堝祦鎼? use xindou;--閸掑棛琚悰? drop table if exists category; create table if not exists category( id int not null primary key auto_increment, cname varchar(20) not null, parentid int not null default 0, description varchar(200), photo blob, ctype tinyint default 1 ) ENGINE=InnoDB;
--create database if not exists xindou default character set gb2312; 改为 -- create database if not exists xindou default character set gb2312;类似的也改一下,另外,这些乱码你是怎么写上去的?
这是我用mysql--front打开后,就变成这个样子了
mysql -uroot -ppassword dbname<c:\text.sql
mysql -uroot -ppassword dbname< F:\sheji\final\dbinit\createtable.sql; 有无提示
source F:\sheji\final\dbinit\createtable.sql;
内容如下:
drop database if exists xindou;--瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋gb2312
--create database if not exists xindou default character set gb2312;
--瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋utf8
create database if not exists xindou default character set utf8;--娴h法鏁ら弫鐗堝祦鎼?
use xindou;--閸掑棛琚悰?
drop table if exists category;
create table if not exists category(
id int not null primary key auto_increment,
cname varchar(20) not null,
parentid int not null default 0,
description varchar(200),
photo blob,
ctype tinyint default 1
) ENGINE=InnoDB;
--create database if not exists xindou default character set gb2312;
--瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋utf8
这些语句显然不对。 你的这个 F:\sheji\final\dbinit\createtable.sql; 是哪儿来的?本身就有问题啊。 直接用记事本打开看看内容是什么。
source F:\sheji\final\dbinit\createtable.sql;
提示什么
是这个样子
--GWAP2.0-閺傛媽鐪寸純鎴濈紦鐞涖劏鍓奸張?--閸掔娀娅庨弫鐗堝祦鎼存挸绨眡indou
drop database if exists xindou;--瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋gb2312
--create database if not exists xindou default character set gb2312;
--瀵ゆ椽鍣烽弫鐗堝祦鎼存挸绨眡indou閿涘苯鑻熼幐鍥х暰鐟欙絿鐖滈梿鍡曡礋utf8
create database if not exists xindou default character set utf8;--娴h法鏁ら弫鐗堝祦鎼?
use xindou;--閸掑棛琚悰?
drop table if exists category;
create table if not exists category(
id int not null primary key auto_increment,
cname varchar(20) not null,
parentid int not null default 0,
description varchar(200),
photo blob,
ctype tinyint default 1
) ENGINE=InnoDB;
改为
-- create database if not exists xindou default character set gb2312;类似的也改一下,另外,这些乱码你是怎么写上去的?
有无提示