在CentOS 6.2中将MySQL版本从5.1升级到5.5

时间:2012-02-20 13:12:51

标签: mysql database centos

我试图在CentOS 6.2中将MySQL从5.1升级到5.5。以下是我所做的过程:

1. rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
2. yum install libmysqlclient15 --enablerepo=webtatic
3. yum remove mysql mysql-*
4. yum install mysql55 mysql55-server --enablerepo=webtatic

当我尝试第4步时,我得到以下输出:

[root@d2005 /]# yum install mysql55 mysql55-server --enablerepo=webtatic
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * base: yum.singlehop.com
 * extras: centos.mirrors.tds.net
 * updates: pubmirrors.reflected.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql55.x86_64 0:5.5.10-1.w5 will be installed
--> Processing Dependency: mysql55-libs = 5.5.10-1.w5 for package: mysql55-5.5.10-1.w5.x86_64
---> Package mysql55-server.x86_64 0:5.5.10-1.w5 will be installed
--> Processing Dependency: perl-DBD-MySQL for package: mysql55-server-5.5.10-1.w5.x86_64
--> Running transaction check
---> Package mysql55-libs.x86_64 0:5.5.10-1.w5 will be installed
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64
--> Running transaction check
---> Package mysql-libs.x86_64 0:5.1.61-1.el6_2.1 will be installed
--> Processing Conflict: mysql55-libs-5.5.10-1.w5.x86_64 conflicts mysql-libs < 5.5.10
--> Finished Dependency Resolution
Error: mysql55-libs conflicts with mysql-libs
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

如何解决?

8 个答案:

答案 0 :(得分:110)

列出Old MySql

yum list installed | grep -i mysql

删除Old MySql

yum remove mysql mysql-*

Remi依赖CentOS 6和Red Hat(RHEL)6

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

安装MySQL服务器

yum --enablerepo=remi,remi-test install mysql mysql-server

列出New MySql

yum list installed | grep -i mysql

启动MySql服务器

/etc/init.d/mysqld start ##在更新后使用重启

或者

service mysqld start ##在更新后使用重启

chkconfig --levels 235 mysqld on

最后

mysql_upgrade -u root -p

现在我的MySql版本是5.5.32

价:

http://www.webtatic.com/packages/mysql55/

http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/

希望它有所帮助

注意:     从@pim添加评论(在评论中)

Just wanted to add that after the upgrade, my crontab was removed as well. Had to reinstall with "yum install vixie-cron" (CentOS 6) 

答案 1 :(得分:27)

我使用以下命令添加新的YUM repo并进行更新:

下载Remi回购

cd /etc/yum.repos.d
wget http://rpms.famillecollet.com/enterprise/remi.repo

安装/更新mysql版本

yum --enablerepo=remi install mysql-server

OR

yum --enablerepo=remi update mysql-server

答案 2 :(得分:6)

您似乎使用了错误的Webtatic Yum存储库版本,而不是您的CentOS版本。有关详细信息,请参阅http://www.webtatic.com/projects/yum-repository/

e.g。

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

您可以使用IUS社区制作的yum插件来使用mysql55w-libs切换mysql-libs。 (以下假设您仍然使用Webtatic)

yum install mysql yum-plugin-replace
yum replace mysql --replace-with mysql55w

这应该允许你用mysql55w-libs替换mysql,同时为任何依赖项维护旧的libmysqlclient。

如果你看到除了mysql之外的其他软件包,那么请注意,因为可能需要它们,但是使用这种方法,我发现每当我使用它时都是可靠的。

我发布此解决方案,因为Remi的存储库并不总是理想的解决方案。此方法更复杂,但永远不会使您使用与基本分发包匹配的包名称的存储库意外更新整个Web堆栈。

答案 3 :(得分:5)

2015/08/19 - 对于那些使用匹配操作系统(通常是32位计算机)的较旧(但仍然不错)硬件的人。

- 这将升级到mysql 5.6社区而不是5.5 -

经过一些研究和混合/匹配/测试在互联网的各个页面上找到的答案(主要来自此页面和http://dev.mysql.com/doc/refman/5.6/en/linux-installation-yum-repo.html),这对我有用。 我的操作系统附带了mysql 5.1,我想拥有5.6。

我的系统

[root@host]# cat /etc/*release 
CentOS release 6.7 (Final)
[root@host]# uname -a
Linux host 2.6.32-573.3.1.el6.i686 #1 SMP Thu Aug 13 19:58:36 UTC 2015 i686 i686 i386 GNU/Linux
[root@host]# arch
i686

这是安装在2006 mac pro 1.1(CPU升级到3.0GHz Intel Xeon X5365四核)上。

我跑的命令

这是在通过yum

重新安装操作系统和系统更新后几乎立即完成的

列出当前安装的mysql

yum list installed | grep -i mysql

删除已安装的msql

yum remove mysql mysql-*

列出当前安装的mysql

yum list installed | grep -i mysql

下载包含mysql 5.6的rpm

wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

安装mysql

rpm -Uvh mysql-community-release-el6-5.noarch.rpm
yum install mysql mysql-server

列出当前安装的mysql

yum list installed | grep -i mysql

确保mysql在重启时启动

chkconfig --list mysqld
sudo chkconfig mysqld on
chkconfig --list mysqld

启动mysql

service mysqld start
service mysqld status

结果

[root@host]# yum list installed | grep -i mysql
compat-mysql51.i686     5.1.54-1.el6.remi @remi                                 
mysql-community-client.i686
                        5.6.26-2.el6      @mysql56-community                    
mysql-community-common.i686
                        5.6.26-2.el6      @mysql56-community                    
mysql-community-libs.i686
                        5.6.26-2.el6      @mysql56-community                    
mysql-community-release.noarch
mysql-community-server.i686
                        5.6.26-2.el6      @mysql56-community                    
perl-DBD-MySQL.i686     4.013-3.el6       @base


[root@host]# mysql --version
mysql  Ver 14.14 Distrib 5.6.26, for Linux (i686) using  EditLine wrapper

mysql config(我没有触摸过这个,但信息似乎合法)

一些有趣的基本但有效的mysql性能调优:

https://www.digitalocean.com/community/tutorials/how-to-install-mysql-5-6-from-official-yum-repositories

祝你好运!

修改

我在创建用户和授予权限方面遇到了一些问题,这是如何修复的。

错误

ERROR 1054 (42S22) at line 1: Unknown column 'plugin' in 'mysql.user'

修复

  1. 以root身份登录服务器
  2. 使用简单的mysql
  3. 连接到mysql
  4. 检查了此声明的结果:SELECT COUNT(1) column_count FROM information_schema.columns WHERE table_schema='mysql' AND table_name='user';结果是39,43预计为mysql 5.6
  5. 发布此声明以更新root密码:update mysql.user set Password=PASSWORD('root') where User='root';
  6. (使用exit注销mysql)
  7. 使用:service mysqld restart
  8. 重新启动mysql
  9. Ran:mysql_upgrade -uroot -proot --force
  10. 使用mysql -uroot -proot
  11. 重新连接到mysql
  12. 检查了该语句的结果:SELECT COUNT(1) column_count FROM information_schema.columns WHERE table_schema='mysql' AND table_name='user';结果为43,正如mysql 5.6所期望的那样。然后,我可以根据需要创建用户并授予权限。

答案 4 :(得分:4)

以上回复对我不起作用(得到此错误 - 错误:/var/tmp/rpm-tmp.tyukGy:不是rpm包)。

我按照这些步骤 -

## Remove existing/old MySQL ##
yum remove mysql mysql-*
rm -rf /var/lib/mysql
rm -rf /var/log/mysql*

## Install Remi Repository on RHEL/CentOS 6.7-6.0 ##
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm 

## Install Remi Repository on RHEL/CentOS 5.4-5.0 ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

yum --enablerepo=remi list mysql mysql-server
yum --enablerepo=remi install mysql mysql-server

取自 - http://www.tecmint.com/install-mysql-on-rhel-centos-6-5-fedora-17-12/

通过上面的操作,我卸载了MySQL 5.0。*并将其替换为 -

[root@localhost]# /usr/bin/mysqladmin -u root -p version
/usr/bin/mysqladmin  Ver 8.42 Distrib 5.5.28, for Linux on x86_64
Copyright (c) 2000, 2012, 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.

Server version      5.5.28
Protocol version    10
Connection      Localhost via UNIX socket
UNIX socket     /var/lib/mysql/mysql.sock
Uptime:         32 sec

Threads: 1  Questions: 3  Slow queries: 0  Opens: 33  Flush tables: 1  Open tables: 26  Queries per second avg: 0.093
[root@localhost]# 

我的CentOS版本 -

[root@localhost]# cat /etc/redhat-release
CentOS release 6.3 (Final)
[root@localhost]# uname -a
Linux localhost.localdomain 2.6.32-279.14.1.el6.x86_64 #1 SMP Tue Nov 6 23:43:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

答案 5 :(得分:3)

使用CentOS-Release-SCL更好更容易。

The Software Collections ( SCL ) Repository

# yum install centos-release-SCL
# yum install mysql55-mysql-server

完成。

答案 6 :(得分:2)

This blog post帮助我从MySQL 5.5.15升级到5.5.28。该升级还存在mysql-libsmysql55-libs冲突的问题。

答案 7 :(得分:1)

wget -P /etc/yum.repos.d  http://rpms.famillecollet.com/enterprise/remi.repo
yum --enablerepo=remi -y install mysql-server
OR
yum --enablerepo=remi -y update mysql-server