1.查看操作系统相关信息。

[root@linuxidc ~]# cat /etc/issue 
CentOS release 6.5 (Final) 
Kernel \r on an \m 
[root@linuxidc ~]# uname -a 
Linux linuxidc 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

2.创建需要下载rpm软件包的目录。
1 [root@linuxidc ~]# mkdir -p /taokey/tools

3.查看下是否有系统自带mysql的rpm包,如果有,需要删除自带的旧rpm包。
[root@linuxidc ~]# rpm -qa | grep mysql 
mysql-libs-5.1.71-1.el6.x86_64 
[root@linuxidc ~]# yum -y remove mysql-libs-5.1* 
[root@linuxidc ~]# rpm -qa | grep mysql 
[root@linuxidc ~]#

4.在MySQL官网下载安装MySQL-5.6.21所需的rpm软件包。
需要下载三个rpm软件包:
MySQL-client-5.6.21-1.rhel5.x86_64.rpm  
MySQL-devel-5.6.21-1.rhel5.x86_64.rpm  
MySQL-server-5.6.21-1.rhel5.x86_64.rpm 
[root@linuxidc ~]# cd /taokey/tools/ 
[root@linuxidc tools]# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm 
[root@linuxidc tools]# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.21-1.rhel5.x86_64.rpm 
[root@linuxidc tools]# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.21-1.rhel5.x86_64.rpm

5.下载完之后,安装三个rpm软件包。
[root@linuxidc tools]# rpm -ivh MySQL-server-5.6.21-1.rhel5.x86_64.rpm 
error: Failed dependencies:
        libaio.so.1()(64bit) is needed by MySQL-server-5.6.21-1.rhel5.x86_64
        libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.6.21-1.rhel5.x86_64
        libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.6.21-1.rhel5.x86_64
安装MySQL-server报错,原因是没有安装libaio,系统缺少libaio.so此软件包,下边yum安装一下libaio.so软件包。
[root@linuxidc tools]# yum install -y libaio 
[root@linuxidc tools]# rpm -ivh MySQL-server-5.6.21-1.rhel5.x86_64.rpm 
[root@linuxidc tools]# rpm -ivh MySQL-client-5.6.21-1.rhel5.x86_64.rpm  
Preparing...                ########################################### [100%] 
  1:MySQL-client          ########################################### [100%] 
[root@linuxidc tools]# rpm -ivh MySQL-devel-5.6.21-1.rhel5.x86_64.rpm  
Preparing...                ########################################### [100%] 
  1:MySQL-devel            ########################################### [100%]

6.修改配置文件位置。
[root@linuxidc tools]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

7.初始化MySQL及修改MySQL默认的root密码。
[root@linuxidc tools]# /usr/bin/mysql_install_db 
[root@linuxidc tools]# ps -ef | grep mysql 
root      2188    1  0 14:48 pts/1    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/linuxidc.pid 
mysql    2303  2188 30 14:48 pts/1    00:00:02 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/linuxidc.err --pid-file=/var/lib/mysql/linuxidc.pid 
root      2331  1853  0 14:49 pts/1    00:00:00 grep mysql 
[root@linuxidc tools]# netstat -anpt | grep 3306 
tcp        0      0 :::3306                    :::*                        LISTEN      2303/mysqld
[root@linuxidc tools]# more /root/.mysql_secret 
# The random password set for the root user at Thu Apr  9 14:43:59 2015 (local time): F6K3v_xggFoLQeiN 
  
[root@linuxidc tools]# mysql -uroot -pF6K3v_xggFoLQeiN 
Warning: Using a password on the command line interface can be insecure. 
Welcome to the MySQL monitor.  Commands end with ; or \g. 
Your MySQL connection id is 1 
Server version: 5.6.21 
  
Copyright (c) 2000, 2014, 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> SET PASSWORD = PASSWORD('123.com');  
mysql> exit
Bye 
[root@linuxidc tools]# mysql -uroot -p123.com 
Warning: Using a password on the command line interface can be insecure. 
Welcome to the MySQL monitor.  Commands end with ; or \g. 
Your MySQL connection id is 6 
Server version: 5.6.21 MySQL Community Server (GPL) 
  
Copyright (c) 2000, 2014, 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>

8.设置MySQL服务开机自启动。
[root@linuxidc tools]# chkconfig mysql on 
[root@linuxidc tools]# chkconfig mysql --list 
mysql          0:off  1:off  2:on    3:on    4:on    5:on    6:off

到此为止,使用RPM安装MySQL5.6版本数据库安装完毕,谢谢大家。

CentOS 6.5下安装MySQL 5.6.21  http://www.linuxidc.com/Linux/2015-01/111413.htm

本文永久更新链接地址http://www.linuxidc.com/Linux/2015-04/116003.htm

最新文章

  1. NFS服务器搭建——可用于共享文件或负载均衡文件共享服务器使用
  2. 产经新闻:公交WiFi这次能扛多久
  3. 总结:客户端与服务器端使用正则增加URL参数的方法
  4. BaseDao代码,用于连接数据库实行增删改查等操作
  5. ACM/ICPC 之 BFS(离线)+康拓展开(TSH OJ-玩具(Toy))
  6. Signalr简单例子
  7. arcgis server 10.2安装后,忘记Manager的用户名和密码
  8. java加解密操作过程中的中文乱码问题
  9. Redis 高可用性解决方案(Sentinel)
  10. Solr笔记--转载
  11. java ZIP压缩文件
  12. SVN权限修复
  13. OD: Memory Attach Technology - Exception
  14. FusionCharts封装-Value
  15. 使用input file上传文件中onChange事件只触发一次问题
  16. Head First Python-Python中与文件相关的操作-读、处理、写
  17. ASCII,Unicode,GBK和UTF-8字符编码的区别和联系
  18. (链表 递归) leetcode 24. Swap Nodes in Pairs
  19. 清理孤儿文件 clearing up outdated orphans
  20. KM算法 带权二分匹配 O(n^3)

热门文章

  1. <Java><类加载机制><反射>
  2. python 三方库
  3. python day03--字符串
  4. 对于src路径问题,深层理解的实践。且对于输出流write()两个方法的源码阅读。
  5. Python 使用sqlalchemy操作MYSQL
  6. [转]Ubuntu安装Python3.6
  7. 一个跳转提示页面---JS
  8. 20165228 2017-2018-2 《Java程序设计》第3周学习总结
  9. git get submodule after clone
  10. mysql设置外键约束开启-关闭