易截截图软件、单文件、免安装、纯绿色、仅160KB

MySQL命令

1. 连接mysql:
mysql -h 主机地址 -u 用户名 -p
2.退出mysql:exit
3. 修改密码:
mysqlbinmysqladmin -uroot -p(oldpassword) password newpassword
4.增加用户:
添加一个用户test1 密码为ABC;让他可以在任何主机上登录,并对所有数据库有查询、插入、修改、删除的权限。首先用以root用户连入
mysql,然后键入以下命令:grant select,insert,update,delete on *.* to test1@"%" Identified
by "abc";
增加一个用户test2密码为abc,让其只可以在localhost上登录,并可以对数据库mydb进行查询、插入、修改、删除的操作(localhost指本地
主机,即mysql数据库所在的那台主机),这样用户即使用知道test2的密码,也无法从internet上直接访问数据库,只能通过mysql主机上的web页
来访问了。grant select,insert,update,delete on mydb.* to test2@localhost identified by "abc";
增加一个可以从任何地方连接服务器的一个完全的超级用户
grant all privileges on *.* to test3@"%" identified by 'password' with grant option;
5.删除授权
revoke select,insert,update,delete om *.* from test2@localhost ;
--------------------------------------------------------
6.显示数据库
show databases;
7.显示数据库中的表
use dataname;
show tables;
8.显示表的结构
describe tablesname;
9.建库
create database 库名;
10.建表
use dataname;
create table teacher //建立表TEACHER
(
id int(3) auto_increment not null primary key,
name char(10) not null,
address varchar(50) default '深圳',
year date
); //建表结束
//以下为插入字段
insert into teacher values('','glchengang','深圳一中','1976-10-10');
insert into teacher values('','jack','深圳一中','1975-12-23');
注:在建表中
(1) 将ID设为长度为3的数字字段:int(3),并让它每个记录自动加一: auto_increment,
并不能为空:not null,而且让它成为主字段primary key
(2) 将NAME设为长度为10的字符字段
(3) 将ADDRESS设为长度50的字符字段,而且缺省值为深圳。varchar和char有什么区别
呢,只有等以后的文章再说了。
(4) 将YEAR设为日期字段。
如果你在mysql提示符键入上面的命令也可以,但不方便调试。 你可以将以上命令
原样写入一个文本文件中假设为school.sql,然后复制到c:下,并在DOS状态进入目录
mysql in,然后键入以下命令


相关文档:

Quick Test Setup of MySQL Cluster


To familiarize you with the basics, we will describe the simplest
possible configuration for a functional MySQL Cluster. After this,
you should be able to design your desired setup from the
information provided in the other relevant sections of this
chapter.
......

MySQL Cluster配置step by step

MySQL Cluster配置step by step
来源:http://space.itpub.net/15415488/viewspace-620903
公司有个项目是测试distributed DB,其中一项是针对MySQL Cluster的测试。
于是花了两天时间装机器和配置MySQL Cluster。整个过程还是比较顺利的,当然如果对MySQL常用命令比较熟悉的话会更顺利。
留下step by step配 ......

遇到的一个mysql备份恢复的问题

数据库特点
--使用partition,存在上百个分区
--建表时指定了data_dir和index_dir,数据不是存储在默认位置,而是在mysqld的数据目录下link到真正的数据文件
备份恢复要求
--备份出来的数据恢复时要恢复成不同的表名
--恢复出来的数据实际存储位置也要存储在与原表不同的位置
问题
如果直接mysqldump-sourc ......

mySQL简单创建数据库、表、改变数据库路径

创建数据库:
mysql>create database test;
Query OK, 1 row affected (0.02 sec)
创建数据库表:
mysql>use test;
Database changed
创建数据库表:
myaql>create table user(SID VARCHAR(11), name VARCHAT(6) );
Query OK, 0 rows affected (0.08 sec)
插入记录:
mysql>insert int use ......

mysql的三种安装方式

安装的OS为Solaris10,mysql 版本是5.1.38
一、使用RPM包进行安装

    首先可以从安装光盘中或者到mysql的网站上下载对应版本的rpm包如下:
MySQL-server-community-5.1.38-0.rhel5.i386.rpm
MySQL-client-community-5.1.38-0.rhel5.i386.rpm
    接着我们可以使用rpm命 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号