1、在c:\下创建sheying.sql这个文件,用“记事本”创建。

2、打开这个文件,创建一个表:
create table `shangpinxinxi`(
`fenlei` varchar(8) not null,
`mingcheng` varchar(30) not null,
`zhujima` varchar(30) not null,
`danwei` varchar(6) not null,
`jiage` float not null,
`hyjiage` float not null,
primary key(`fenlei`,`mingcheng`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

3、打开mysql数据库。

4、启动mysql客户端。
mysql.exe --defaults-file=my.ini -uroot -p

5、show databases;显示当前数据库。

6、create database sheying;创建sheying数据库。

7、use sheying;打开sheying数据库。

8、source c:/sheying.sql;执行sheying.sql这个文件。
在数据库创建一个表:shangpinxinxi.

9、show tables ;显示打开数据库所有表。

10、show columns from shangpinxinxi;显示shangpinxinxi这个表的结构。

11、mysql创建数据库和表已经完成。
