创建MYSQL的代码

liuchangfei 2010-06-07 10:58:06
如何用代码创建MYSQL???
就像创建MSSQL一样,
create database 数据库名称
on
(
name='aaa',
filename='aaa.dbf',
size=初始大小,
maxsize=存储上限,
filegrowth=增长增量
)
log on
(
name='b',
filename='b.ldf',
size=初始大小,
maxsize=存储上限,
filegrowth=增长增量
)
...全文
111 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
dawugui 2010-06-08
  • 打赏
  • 举报
回复
mysql帮顶了.
liuchangfei 2010-06-08
  • 打赏
  • 举报
回复
我要的是创建的时候限制数据库的大小,现在数据库的存放位置,还有就是归那个用户所有???
永生天地 2010-06-07
  • 打赏
  • 举报
回复
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
htl258_Tony 2010-06-07
  • 打赏
  • 举报
回复
MYSQL帮顶了。

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧