在CentOS6上用RPM包安装MySQL

服务器上安装的是CentOS 6.3,原本用yum安装了MySQL但是版本过低,于是打算用RPM来升级

首先直接到MySQL的官网下载RPM包

http://www.mysql.com/downloads/mysql/#downloads

下载的系统选择Redhat 6就可以了,我安装的是x64的,所以选择了MySQL-server-5.5.29-2.el6.x86_64.rpm和MySQL-server-5.5.29-2.rhel5.x86_64.rpm

然后直接rpm -ivh MySQL-server-5.5.29-2.el6.x86_64.rpm结果告诉我这个:


error: Failed dependencies:
libaio.so.1()(64bit) is needed by MySQL-server-5.5.29-2.rhel5.x86_64
libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.5.29-2.rhel5.x86_64
libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.5.29-2.rhel5.x86_64
mysql conflicts with MySQL-server-5.5.29-2.rhel5.x86_64
MySQL conflicts with mysql-5.1.61-4.el6.x86_64

嗯,意思就是缺少libaio这个包了,于是用yum来简单安装之:

yum install libaio

接着再继续安装,结果报告以下错误:


error: Failed dependencies:
mysql conflicts with MySQL-server-5.5.29-2.rhel5.x86_64
MySQL conflicts with mysql-5.1.61-4.el6.x86_64

原因就是——忘了卸载之前的MySQL了,于是:

rpm -qa mysql

得到的结果是:

mysql-5.1.61-4.el6.x86_64

用rpm -e mysql 卸载之,再安装……于是这次报告:


file /usr/share/mysql/charsets/README from install of MySQL-server-5.5.29-2.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.61-4.el6.x86_64
file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-5.5.29-2.rhel5.x86_64 conflicts with file from package mysql-libs-5.1.61-4.el6.x86_64

…………

一大堆的错误日志

查询了一下,这是因为MySQL的依赖没有完全卸载掉……于是运行

rpm -e --nodeps mysql-libs

再次安装,这次成功了,提示让你修改root的密码,先无视,先安装client

rpm -ivh MySQL-client-5.5.29-2.el6.x86_64.rpm

然后启动MySQL:

service mysql start

修改root密码:

mysqladmin -u root password 'xxxxxx'

运行MySQL本地安全策略工具:

/usr/bin/mysql_secure_installation

输入MySQLroot的密码,然后依次:
选择是否修改root密码(刚改了就算了
是否禁用匿名登录(Y
是否禁止root远程登录(Y
是否删除test数据库(Y
是否立刻重新载入权限(Y

然后把my.conf整出来吧,执行

cp /usr/share/doc/MySQL-server-5.5.29/my-huge.cnf /etc/my.cnf

然后修改


key_buffer_size = 64M
max_allowed_packet = 10M
table_open_cache = 128
sort_buffer_size = 8M
read_buffer_size = 32M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 8M
thread_cache_size = 80
query_cache_size = 64M


嗯,到这一步差不多就做完了,剩下就是加入权限和数据库了



评论

此博客中的热门博文

转一下关于Fuck的用法

远程记录OpenWRT日志

用OpenWRT打造自动翻墙路由器(详解篇)