中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 操作系统 > Linux > Linux综合
mysql的安装及使用
作者:未知 时间:2005-09-13 22:04 出处:Blog.ChinaUnix.net 责编:chinaitpower
              摘要:mysql的安装及使用
我的简单安装及初级使用。(摘录一些初级应用,基础很重要的)以备以后查看。

参考安装文档:
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
shell> gunzip < /PATH/TO/MYSQL-VERSION-OS.tar.gz | tar xvf -
shell> ln -s FULL-PATH-TO-MYSQL-VERSION-OS mysql shell> cd mysql
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql & 启动mysql;

一、连接MYSQL。格式: mysql -h主机地址 -u用户名 -p用户密码

二、修改密码。格式:mysqladmin -u用户名 -p旧密码 password 新密码

三、增加新用户。(注意:和上面不同,下面的因为是MYSQL环境中的命令,所以后面都带一个分号作为命令结束符)

格式:
grant select on 数据库.* to 用户名@登录主机 identified by "密码"

grant select,insert,update,delete on *.* to test1@"%" Identified by "abc";

grant select,insert,update,delete on mydb.* to test2@localhost identified by "abc";

如果你不想test2有密码,可以再打一个命令将密码消掉。
grant select,insert,update,delete on mydb.* to test2@localhost identified by "";

[root@proxy bin]# ./mysql -uroot -pmysql

Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL

connection id is 23 to server version: 4.0.24-standard Type 'help;' or '\h' for help.

Type '\c' to clear the buffer.

mysql>

1、显示数据库列表。
show databases; 刚开始时才两个数据库:mysql和test。mysql库很重要它里面有MYSQL的系统信息,我们改密码和新增用户,实际上就是用这个库进行操作。
2、显示库中的数据表:
 show tables;
3、显示数据表的结构: describe 表名; 
4、建库:  create database 库名; 
5、建表: 库名; create table 表名 (字段设定列表);
6、删库和删表: drop database 库名; drop table 表名;
7、将表中记录清空: delete from 表名;
8、显示表中的记录: select * from 表名;

关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有