我在自己的机器实现
我在dos下进入到mysql\bin目录下,命令下敲入mysql -uroot -p123 < c:\warehousel.sql
出现错误时acess denied for user root@localhost<use passward:yes> 错误是1045
我上网查资料后,用为root分配可能大的权限,在服务器上写:grant all on *.* to root@'%' identified by '123'
但结果还是如此,奇怪,后台有mysqld-nt.exe进程!
脚本代码如下
# -----------------------------------------------------------------------
# warehouse
# -----------------------------------------------------------------------
drop database if exists warehouse;
CREATE database warehouese;
use warehouse;
# -----------------------------------------------------------------------
# userinfo
# -----------------------------------------------------------------------
drop table if exists userinfo;
CREATE TABLE userinfo
(
userid INT UNSIGNED NOT NULL AUTO_INCREMENT,
username VARCHAR (12) NOT NULL,
userpassword VARCHAR (12) NOT NULL,
role INT UNSIGNED NOT NULL,
PRIMARY KEY(userid)
);
# -----------------------------------------------------------------------
# goods
# -----------------------------------------------------------------------
drop table if exists goods;
CREATE TABLE goods
(
goodid INT UNSIGNED NOT NULL AUTO_INCREMENT,
goodname VARCHAR (64) NOT NULL,
goodprice float(5,2) NOT NULL,
goodquality INT UNSIGNED NOT NULL,
goodpublish VARCHAR (128) NOT NULL,
PRIMARY KEY(goodid)
);
# -----------------------------------------------------------------------
# orders
# -----------------------------------------------------------------------
drop table if exists orders;
CREATE TABLE orders
(
orderid INT UNSIGNED NOT NULL AUTO_INCREMENT,
userid INT UNSIGNED NOT NULL,
goodid INT UNSIGNED,
type INT UNSIGNED NOT NULL,
goodname VARCHAR (64),
goodprice float(5,2),
goodquality INT UNSIGNED,
goodpublish VARCHAR (128),
PRIMARY KEY(orderid)
);
我的MySQL服务已经开启了,是什么原因呢?麻烦各位看一下