网络编程
位置:首页>> 网络编程>> 数据库>> window安装mysql(zip、noinstall)(2)

window安装mysql(zip、noinstall)(2)

 来源:asp之家 发布时间:2009-10-17 21:10:00 

标签:window,mysqsl,安装

8、创建数据库

实际上mysql数据库中除了mysql数据库外,还有一个空的数据库test,供用户测试使用。

现在继续创建一个数据库testdb,并执行一系列sql语句看看mysql数据库的基本操作。

创建数据库testdb:

create database testdb;

预防性创建数据库:

create database if not testdb

创建表:

use testdb;

create table table1(

username varchar(12),

password varchar(20));

预防性创建表aaa:

create table if not exists aaa(ss varchar(20));

查看表结构:

describe table1;

插入数据到表table1:

insert into table1(username,password) values

('leizhimin','lavasoft'),

('hellokitty','hahhahah');

commit;

查询表table1:

select * from table1;

更改数据:

update table1 set password='hehe' where username='hellokitty';

commit;

删除数据:

delete from table1 where username='hellokitty';

commit;

给表添加一列:

alter table table1 add column(

sex varchar(2) comment '性别',

age date not null comment '年龄'

);

commit;

从查询创建一个表table1:

create table tmp as

select * from table1;

删除表table1:

drop table if exists table1;

drop table if exists tmp;

9、备份数据库testdb

mysqldump -h 192.168.3.143 -u root -pleizhimin -x --default-character-set=gbk >C:testdb.sql

10、删除数据库testdb

drop database testdb;

11、恢复testdb数据库

首先先建立testdb数据库,然后用下面命令进行本地恢复:

mysql -u root -pleizhimin testdb <C:testdb.sql

12、删除mysql服务

假如你厌倦mysql了,你需要卸载,那么你只需要这么做

停止mysql服务

net stop mysql5

删除mysql服务

sc delete mysql5

mysqld-nt --remove

然后删除msyql的安装文件夹,不留任何痕迹。

MySQL服务器既可以做为前台服务程运行,也可以做为后台服务运行。在MySQL安装目录的bin目录下提供了以下MySQL服务程序:

mysqld.exe:最基本的MySQL服务器程序。

mysqld-nt.exe:Windows NT/2000/XP平台的优化版本,支持命名管道。

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com