mysql数据库rpm包_MySQL数据库系列之Centos6.5系统下RPM包安装MySQL5.6

[关于在Centos系统下安装MYSQL数据库,网络上资料有很多,在此主要感谢该文章的博主:http://www.cnblogs.com/zhoulf/archive/2013/01/25/zhoulf.html,因为相对来说,该篇

查看操作系统相关信息。 1 2 3 4 5

[root@bj_db1 ~]

# cat /etc/issue

CentOS release 6.5 (Final)

Kernel \r on an \m

[root@bj_db1 ~]

# uname -a

Linux bj_db1 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@bj_db1 ~]

# mkdir -p /taokey/tools

3.查看下是否有系统自带mysql的rpm包,如果有,需要删除自带的旧rpm包。 1 2 3 4 5

[root@bj_db1 ~]

# rpm -qa | grep mysql

mysql-libs-5.1.71-1.el6.x86_64

[root@bj_db1 ~]

# yum -y remove mysql-libs-5.1*

[root@bj_db1 ~]

# rpm -qa | grep mysql

[root@bj_db1 ~]

#

4.在MySQL官网下载安装MySQL-5.6.21所需的rpm软件包。

需要下载三个rpm软件包: 1 2 3 4 5 6 7

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@bj_db1 ~]

# cd /taokey/tools/

[root@bj_db1 tools]

# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-server-5.6.21-1.rhel5.x86_64.rpm

[root@bj_db1 tools]

# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-devel-5.6.21-1.rhel5.x86_64.rpm

[root@bj_db1 tools]

# wget http://dev.mysql.com/Downloads/MySQL-5.6/MySQL-client-5.6.21-1.rhel5.x86_64.rpm

5.下载完之后,安装三个rpm软件包。

[root@bj_db1 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软件包。 1 2 3 4 5 6 7 8

[root@bj_db1 tools]

# yum install -y libaio

[root@bj_db1 tools]

# rpm -ivh MySQL-server-5.6.21-1.rhel5.x86_64.rpm

[root@bj_db1 tools]

# rpm -ivh MySQL-client-5.6.21-1.rhel5.x86_64.rpm

Preparing...

########################################### [100%]

1:MySQL-client

########################################### [100%]

[root@bj_db1 tools]

# rpm -ivh MySQL-devel-5.6.21-1.rhel5.x86_64.rpm

Preparing...

########################################### [100%]

1:MySQL-devel

########################################### [100%]

6.修改配置文件位置。[root@bj_db1 tools]

# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

7.初始化MySQL及修改MySQL默认的root密码。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

[root@bj_db1 tools]

# /usr/bin/mysql_install_db

[root@bj_db1 tools]

# /etc/init.d/mysql start

[root@bj_db1 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/bj_db1

.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/bj_db1

.err --pid-

file

=

/var/lib/mysql/bj_db1

.pid

root      2331  1853  0 14:49 pts

/1

00:00:00

grep

mysql

[root@bj_db1 tools]

# netstat -anpt | grep 3306

tcp        0      0 :::3306                     :::*                        LISTEN      2303

/mysqld

[root@bj_db1 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@bj_db1 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@bj_db1 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服务开机自启动。 1 2 3

[root@bj_db1 tools]

# chkconfig mysql on

[root@bj_db1 tools]

# chkconfig mysql --list

mysql           0:off   1:off   2:on    3:on    4:on    5:on    6:off

9.MySQL三中修改账号密码的方法:

1).为特定用户账号设置密码;

SET PASSWORD FOR "username"@"host" = PASSWORD("123.com");

2).直接修改表中内容的方式,修改数据库账号密码;

update user set password=PASSWORD('your_password') WHERE User='root' and host='hostname or ip';

通常修改不会立即生效,需要执行flush

3).mysqladmin修改root密码

mysqladmin -u root -h127.0.0.1 -p password 'new_password'

回车之后要求输入旧密码,旧密码为空直接回车即可。

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

[1.先安装MySQL,直接yum安装   yum-yinstallmysqlmysql-server2.再安装一些依赖的包   yum-yinstallopensslopenssl-devellibss-devgccgcc-c++mysql-devel3.下载bind,bind

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值