【转载】----CentOS6.5系统下RPM包安装MySQL5.6

前端之家收集整理的这篇文章主要介绍了【转载】----CentOS6.5系统下RPM包安装MySQL5.6前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

转载自:http://www.linuxidc.com/Linux/2015-04/116003.htm

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

[root@linuxidc ~]# cat /etc/issue
CentOSrelease 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,Oracleand/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,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.21http://www.linuxidc.com/Linux/2015-01/111413.htm

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

猜你在找的CentOS相关文章