• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

mysql的安装及使用

发布: 2007-7-04 17:55 | 作者: admin | 来源:  网友评论 | 查看: 9次 | 进入软件测试论坛讨论

领测软件测试网 我的简单安装及初级使用。(摘录一些初级应用,基础很重要的)以备以后查看。

参考安装文档:
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 表名;

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网