1、MySQL下载地址。

www.mysql.com/downloads/mysql-4.0.html

下载MySQL 5.1版本的2个包(根据你的实际需求下载所需要的包):

MySQL-server-community-5.1.68-1.rhel5.i386.rpm

MySQL-client-community-5.1.68-1.rhel5.i386.rpm

2、安装server和client安装包。

[root@serv22 mnt]# rpm -ivh MySQL-server-community-5.1.68-1.rhel5.i386.rpm

Preparing...             ########################################### [100%]
1:MySQL-server-community ########################################### [100%]

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin -u root -h serv22 password 'new-password'

Alternatively you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test databases and anonymous user created by default. 
This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems with the /usr/bin/mysqlbug script!

Starting MySQL..[ OK ]

Giving mysqld 2 seconds to start

[root@serv22 mnt]# rpm -ivh MySQL-client-community-5.1.68-1.rhel5.i386.rpm

Preparing...             ########################################### [100%]
1:MySQL-client-community ########################################### [100%]

3、安装完后直接运行 “mysql” 命令登陆数据库,看是否安装成功。

[root@serv22 mnt]# mysql

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

Your MySQL connection id is 1

Server version: 5.1.68-community MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. 
Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

如果出现以上提示,说明安装成功。

4、查看有哪些数据库,系统会默认安装几个数据库。

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql      |

| test         |

+--------------------+

3 rows in set (0.00 sec)

使用mysql数据库

mysql> use mysql;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A
Database changed

查看数据库里有哪些表

mysql> show tables;

+---------------------------+

| Tables_in_mysql |

+---------------------------+

| columns_priv |

| db |

| event |

| func |

| general_log |

| help_category |

| help_keyword |

| help_relation |

| help_topic |

| host |

| ndb_binlog_index |

| plugin |

| proc |

| procs_priv |

| servers |

| slow_log |

| tables_priv |

| time_zone |

| time_zone_leap_second |

| time_zone_name |

| time_zone_transition |

| time_zone_transition_type |

| user |

+---------------------------+

23 rows in set (0.00 sec)

查看表的结构,比如user表。

mysql> desc user;

+-----------------------+-----------------------------------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+-----------------------+-----------------------------------+------+-----+---------+-------+

| Host | char(60) | NO | PRI | | |

| User | char(16) | NO | PRI | | |

| Password | char(41) | NO | | | |

| Select_priv | enum('N','Y') | NO | | N | |

| Insert_priv | enum('N','Y') | NO | | N | |

| Update_priv | enum('N','Y') | NO | | N | |

| Delete_priv | enum('N','Y') | NO | | N | |

| Create_priv | enum('N','Y') | NO | | N | |

| Drop_priv | enum('N','Y') | NO | | N | |

| Reload_priv | enum('N','Y') | NO | | N | |

| Shutdown_priv | enum('N','Y') | NO | | N | |

| Process_priv | enum('N','Y') | NO | | N | |

| File_priv | enum('N','Y') | NO | | N | |

| Grant_priv | enum('N','Y') | NO | | N | |

| References_priv | enum('N','Y') | NO | | N | |

| Index_priv | enum('N','Y') | NO | | N | |

| Alter_priv | enum('N','Y') | NO | | N | |

| Show_db_priv | enum('N','Y') | NO | | N | |

| Super_priv | enum('N','Y') | NO | | N | |

| Create_tmp_table_priv |enum('N','Y') |NO | | N | |

| Lock_tables_priv | enum('N','Y') | NO | | N | |

| Execute_priv | enum('N','Y') | NO | | N | |

| Repl_slave_priv | enum('N','Y') | NO | | N | |

| Repl_client_priv | enum('N','Y') | NO | | N | |

| Create_view_priv | enum('N','Y') | NO | | N | |

| Show_view_priv | enum('N','Y') | NO | | N | |

| Create_routine_priv | enum('N','Y') | NO | | N | |

| Alter_routine_priv | enum('N','Y') | NO | | N | |

| Create_user_priv | enum('N','Y') | NO | | N | |

| Event_priv | enum('N','Y') | NO | | N | |

| Trigger_priv | enum('N','Y') | NO | | N | |

| ssl_type |enum('','ANY','X509','SPECIFIED') | NO | | | |

| ssl_cipher | blob | NO | | NULL | |

| x509_issuer | blob | NO | | NULL | |

| x509_subject | blob | NO | | NULL | |

| max_questions | int(11) unsigned | NO | | 0 | |

| max_updates | int(11) unsigned | NO | | 0 | |

| max_connections | int(11) unsigned | NO | | 0 | |

| max_user_connections | int(11) unsigned | NO | | 0 | |

+-----------------------+-----------------------------------+------+-----+---------+-------+
39 rows in set (0.01 sec)

查看user表中的数据

mysql> select host,user from user;

+-----------+------+

| host 
| user |

+-----------+------+

| 127.0.0.1 | root |

| localhost | |

| localhost | root |

| serv22 | |

| serv22 | root |

+-----------+------+

5 rows in set (0.00 sec)

--修改root用户的密码

格式:mysqladmin -u用户名 -p旧密码 password 新密码

[root@serv22 mnt]# mysqladmin -uroot password mysql123

再次尝试不加密码登陆数据库,会出现报错信息

[root@serv22 mnt]# mysql

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

使用密码登陆数据库

格式:mysql [-u username] [-h host] [-p[password]] [dbname]

[root@serv22 mnt]# mysql -uroot -pmysql123

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

Your MySQL connection id is 5

Server version: 5.1.68-community MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. 
Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

登陆成功。

Linux下用rpm方式安装MySQL的更多相关文章

  1. CentOS7下通过rpm方式安装MySQL及插入中文问题解决 [原创]

    一 CentOS下通过rpm方式安装MySQL CentOS版本:CentOS-7 MySQL版本:MySQL-5.6.22 在网上搜了一下,Linux下安装MYSQL有三种方式: 1) 通过yum命 ...

  2. Linux下基于源代码方式安装MySQL 5.6

    MySQL为开源数据库,因此能够基于源代码实现安装.基于源代码安装有很多其它的灵活性. 也就是说我们能够针对自己的硬件平台选用合适的编译器来优化编译后的二进制代码.依据不同的软件平台环境调整相关的编译 ...

  3. Linux下通用二进制方式安装MySQL

    1.下载glibc版本的MySQL: https://downloads.mysql.com/archives/community/ 2.查看mysql用户和mysql组是否存在(用户和组的信息存在/ ...

  4. Centos6 系统下源码方式安装Mysql 记录

    在运维工作中经常部署各种运维环境,涉及mysql数据库的安装也是时常需要的.mysql数据库安装可以选择yum在线安装,但是这种安装的mysql一般是系统自带的,版本方面可能跟需求不太匹配. #### ...

  5. [转]在ubuntu linux下以编译方式安装LAMP(apache mysql php)环境

    FROM : http://www.cnblogs.com/eleganthqy/archive/2010/02/28/1675217.html 最近转向到了使用ubuntu做桌面,安装好系统以来一直 ...

  6. CentOS6.5和RedHat6.5下以rpm方式安装mysql-5.6.20

    转帖;http://blog.csdn.net/mw08091020/article/details/39234207 a.检查下linux是不是已经安装了mysql rpm -qa | grep - ...

  7. Linux 下使用yum 命令安装MySQL

    Linux下使用yum安装MySQL,以及启动.登录和远程访问MySQL数据库. 1.yum安装mysql 1. 查看有没有安装包:   yum list mysql*    #移除已经安装的mysq ...

  8. rpm方式安装mysql

    一.系统标准化采样 1)查看centos系统版本 [root@fp-web-126 ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 ...

  9. Centos7.3离线(rpm方式)安装mysql服务

    1.mysql官网下载安装包,官网地址:www.mysql.com [root@seiang software]# ll total 580020 -rw-r--r--. 1 root root 59 ...

随机推荐

  1. .NET垃圾回收与内存泄漏

    相信大家一定听过,看过甚至遇到过内存泄漏.在 .NET 平台也一定知道有垃圾回收器,它可以让开发人员不必担心内存的释放问题,因为它会自定管理内存.但是在 .NET 平台下进行编程,绝对不会发生内存泄漏 ...

  2. JavaScript设计模式之代理模式

    一.代理模式概念 代理,顾名思义就是帮助别人做事,GoF对代理模式的定义如下: 代理模式(Proxy),为其他对象提供一种代理以控制对这个对象的访问.代理模式使得代理对象控制具体对象的引用.代理几乎可 ...

  3. 更快的使用你的键盘:AUTOHOTKEY

    本文适合于:每天用电脑工作学习的朋友.游戏发烧手指又不灵敏的朋友.希望提高自己使用电脑效率的朋友. 本文将将告诉你AutoHotkey能做什么,并会一步一步地教会你轻易地使用它,但不会教你更多Auto ...

  4. Sublime Text 3 中文汉化绿色破解特别版下载

    Sublime Text是一款代码编辑器,几乎支持所有语言的编写.sublime给人们的印象不外乎小巧.速度快.并且快捷键丰富而强大.不知繁多的插件. sublime一般被应用到前端的开发.Subli ...

  5. mysql的mvcc(多版本并发控制)

    mysql的mvcc(多版本并发控制) 我们知道,mysql的innodb采用的是行锁,而且采用了多版本并发控制来提高读操作的性能. 什么是多版本并发控制呢 ?其实就是在每一行记录的后面增加两个隐藏列 ...

  6. VitamioBundle-master

    1. 下载资源 (1) 核心插件 VitamioBundle 下载地址:https://github.com/yixia/VitamioBundle (2) 官方示例 VitamioDemo 下载地址 ...

  7. (2015年郑州轻工业学院ACM校赛题) C 数列

    在我们做完B题之后就去看C题了, 发现很多人都已经做出来了, 并且一血还是我们学弟拿的, 感觉这题不难, 我们举了几个例子之后发现全是Alice 然后我们就决定意淫一下,试试看! 没想到就A了 - . ...

  8. 【二分】Codeforces 706B Interesting drink

    题目链接: http://codeforces.com/problemset/problem/706/B 题目大意: n (1 ≤ n ≤ 100 000)个商店卖一个东西,每个商店的价格Ai,你有m ...

  9. 详解C语言的main函数

    如图所示:#include<stdio.h>这是一个头文件,包含的是C程序运行的C语言的库函数,只有包含了相关的头文件,在程序中才能调用.stdio表示输入输出控制.printf():就是 ...

  10. Javascript 操作select控件大全(新增、修改、删除、选中、清空、判断存在等)

    1判断select选项中 是否存在Value="paraValue"的Item 2向select选项中 加入一个Item 3从select选项中 删除一个Item 4删除selec ...