文档介绍:MysqlOracle(甲骨文)大型数据库MySql中小型数据库DB2SqlServer.....Mysql的发展: 瑞典的MysqlAB公司 2008年Sun公司(JAVA) 2009年Oracle收购sun公司 IBM 69亿美元sunEclipse(日蚀) Oracle74亿美元sunMysql的简单使用: win+r--->cmd mysql-uroot-p1234修改密码:mysql>setpasswordforrootlocalhost=password('1234'); 此处可能存在异常情况原因:a、未配置环境变量b、startmysql) showdatabases; 系统自带库: information_schemamysqltest createdatabaseday01;(不指定编码,跟随数据库系统编码) createdatabasedb1 defaultcharactersetgbk;(指定编码) 查看创建库的语句: showcreatedatabase库名. 修改库的编码: alterdatabaseday01 defaultcharactersetutf8; dropdatabase库名. dropdatabaseday01; 注意: 系统自带的三个库不能删除. usedb1; :二维关系表有行有列的关系表. 记录:表中的一行数据. 字段:表中的一列. 常用的字段类型: 字符串类型:varchar(长度)、char 数值类型:int(整数)floatdouble(小数) 日期类型:date :员工号性别年龄职位薪水入职日期 createtableemp( empnovarchar(4), namevarchar(30), sexvarchar(5), ageint(3), jobvarchar(30), salaryint(5), hiredatedate ); showtables; showcreatetable表名. desc表名. insertintoemp (empno,name,sex,age,job,salary,hiredate) values ('1001','zhangsan','m',22,'developer',10000,'2015-12-21'); 简写形式: insertintoempvalues ('1002','lisi','m',23,'test',8000,'2015-10-10'); insertintoemp(empno,name,sex,age)values ('1003','cuihua','w',18); 解决插入中文问题:(eclipse中的设置) ConnectionURL: jdbc:mysql://localhost:3306/test ?useUnicode=true&characterEncoding=gbk 插入中文: insertintoempvalues( '1005','莫小贝','女',12,'武林盟主',20000,'2015-12-12' ); deletefromemp;-->删除表中所有数据 deletefromempwhereempno=1004; MyEclipse配置Mysql连接: . : DriverTemplate:MySQLConnector/J Drivername:随便起名字 ConnectionURL:jdbc:mysql://localhost:3306/test 本机: localhost Username:root password:1234 DriverJARs:mysql-connector-java-- Mysql常见的错误 'tcreatedatabase'xxx';databaseexists不能创建xxx库,因为已经存在 'tdropdatabase'xxx';databasedoesn'texist 不能删除xxx库,因为已经不存在--创建库createdatabasesearchdefaultcharactersetgbk;--使用库usesearch;--创建表--员工信息表 createtableemp( empnoint(4),--员工编号 e