2007-08-03
MySql在DOS的常用命令
MySql在DOS的常用命令:
一、连接MySql:首先进入MySql的安装目录下的MySql\bin下,再键入mysql -uroot -proot,这里假定MySql的登陆名为:root,密码为:root。
二、查询当前版本信息:select version();
三、查询当前日期:select current_date;
四、查询服务器中的所有数据库:show databases;
五、使用test库:use test; 此时会提示:Database changed;
六、查询当前所操作的数据库名称:select database();
七、创建一个名称为pubs的新数据库:create database pubs;
八、删除名为pubs的数据库:drop database if exists pubs;
九、创建一个名为student的表:create table student
(
stu_Id int parmary key not null,
stu_Name varchar(20) not null,
stu_Pass varchar(20) not null,
stu_Age int not null
);
十、显示数据库pubs下的所有表:show tables;
十一、查看数据表student的表结构:describe student;
十二、添加记录:insert into student(stu_Id,stu_Name,stu_Pass,stu_Age)
values(1,'tom','123',20);
十三、修改记录:update student set stu_Name='jerry' where stu_Id=1;
十四、记录查询:select * from student where stu_Id=2;
十五、删除记录:delete from student where stu_Id=1;
十六、删除表:drop table student;
一、连接MySql:首先进入MySql的安装目录下的MySql\bin下,再键入mysql -uroot -proot,这里假定MySql的登陆名为:root,密码为:root。
二、查询当前版本信息:select version();
三、查询当前日期:select current_date;
四、查询服务器中的所有数据库:show databases;
五、使用test库:use test; 此时会提示:Database changed;
六、查询当前所操作的数据库名称:select database();
七、创建一个名称为pubs的新数据库:create database pubs;
八、删除名为pubs的数据库:drop database if exists pubs;
九、创建一个名为student的表:create table student
(
stu_Id int parmary key not null,
stu_Name varchar(20) not null,
stu_Pass varchar(20) not null,
stu_Age int not null
);
十、显示数据库pubs下的所有表:show tables;
十一、查看数据表student的表结构:describe student;
十二、添加记录:insert into student(stu_Id,stu_Name,stu_Pass,stu_Age)
values(1,'tom','123',20);
十三、修改记录:update student set stu_Name='jerry' where stu_Id=1;
十四、记录查询:select * from student where stu_Id=2;
十五、删除记录:delete from student where stu_Id=1;
十六、删除表:drop table student;
发表评论
- 浏览: 26364 次
- 性别:

- 来自: 陕西 西安

- 详细资料
搜索本博客
我的相册
result
共 10 张
共 10 张
最近加入圈子
最新评论
-
DWR实现省市县三级联动
纯js就能搞定了 之前写了个四级联动的 数据用的json 不过。。。代码写的很 ...
-- by zcfg -
JXL使用总结
呵呵,正好需要,谢谢分享~
-- by unique.wu -
JavaScript例子—实现行的 ...
这个代码在FF下是有问题的 我有用的是ff 2.0.0.13
-- by wen870105 -
DWR实现省市县三级联动
楼主能否看看DBManager.java代码?
-- by cnpww -
Asp.Net实现增删改以及分 ...
谢谢楼主。 我是个初学者,之前使用JAVA,刚刚换部门要求学c#.net 这边文 ...
-- by jy786394






评论排行榜