【问题标题】:Update MySQL version from 5.1 to 5.5 in CentOS 6.2在 CentOS 6.2 中将 MySQL 版本从 5.1 更新到 5.5
【发布时间】:2012-03-10 19:53:00
【问题描述】:

我尝试在 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

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

[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

如何解决?

【问题讨论】:

    标签: mysql database centos


    【解决方案1】:

    列出旧的 MySql

    yum list installed | grep -i mysql
    

    删除旧的 MySql

    yum remove mysql mysql-*
    

    CentOS 6 和 Red Hat (RHEL) 6 上的 Remi 依赖关系

    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
    

    列出新的 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 添加 cmets(在 cmets 中)

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

    【讨论】:

    • 我遇到了与 OP 相同的问题。它没有将 mysql-libs 升级到最新版本,而是认为 mysql55-libsmysql-libs 不相关并且相互冲突。如果您先删除以前版本的 MySQL,是否会破坏您的 datadir、ibdata1、/etc/my.cnf、日志等和/或一般目录结构?
    • 我忘了我是为哪台服务器做的...您应该备份您拥有的数据库以及您拥有的日志...我认为您升级后不会拥有它们...
    • 今晚我要试试these steps。我会看看 yum 的 replace 结合 --replace-with 是否会让我跳过 yum remove
    • 好的..如果成功,请将您的答案添加到这个问题..这肯定会帮助其他人......
    • 不好。您删除旧 mysql 的部分不仅仅是 mysql。不得不重新安装服务器。
    【解决方案2】:

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

    下载 Remi 代码库

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

    安装/更新 mysql 版本

    yum --enablerepo=remi install mysql-server
    

    yum --enablerepo=remi update mysql-server
    

    【讨论】:

    • 没问题,我昨天不得不升级,不想卸载旧版本。通过 yum 卸载它提示我也卸载了依赖包,如 php-mysql 和 phpMyAdmin,所以这样我就可以在不先卸载的情况下进行更新。希望它可以帮助某人。
    • 工作愉快,但由于某种原因,我的 phpinfo 没有显示升级,但 phpmyadmin 显示。
    • Could not retrieve mirrorlist rpms.famillecollet.com/enterprise/latest/remi/mirror error was 14: PYCURL ERROR 22 - “The requested URL returned error: 404 Not Found” 错误:找不到 repo 的有效 baseurl:remi
    • 我认为这是最好的答案。这很容易而且有效! +1
    • 非常感谢。 @Drahcir
    【解决方案3】:

    您似乎使用了错误的 Webtatic Yum 存储库版本,而不是您的 CentOS 版本。详情见http://www.webtatic.com/projects/yum-repository/

    例如

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

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

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

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

    如果您看到除 mysql 之外的其他软件包被删除,那么请小心,因为它们可能是需要的,但是使用这种方法,我发现无论何时使用它都是可靠的。

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

    【讨论】:

    • 谢谢安迪,这是旧答案,回购网址可能是错误的..再次感谢您给我们正确的网址..:)
    【解决方案4】:

    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 配置(我还没有碰过这个,但信息似乎是合法的)

    一些有趣的基本但有效的 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连接到mysql
    3. 检查此语句的结果:SELECT COUNT(1) column_count FROM information_schema.columns WHERE table_schema='mysql' AND table_name='user'; 结果为 39,mysql 5.6 应为 43
    4. 发布此声明更新root密码:update mysql.user set Password=PASSWORD('root') where User='root';
    5. (使用exit 注销mysql)
    6. 重启mysql:service mysqld restart
    7. 跑:mysql_upgrade -uroot -proot --force
    8. mysql -uroot -proot重新连接到mysql
    9. 检查了这个语句的结果:SELECT COUNT(1) column_count FROM information_schema.columns WHERE table_schema='mysql' AND table_name='user'; mysql 5.6 的结果是 43。然后我就可以创建我的用户并根据需要授予权限。

    【讨论】:

      【解决方案5】:

      以上回复对我不起作用(收到此错误 - 错误:/var/tmp/rpm-tmp.tyukGy: not an rpm package)。

      我遵循了这些步骤 -

      ## 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
      

      【讨论】:

      • mysql-libs 冲突失败后对我很有用
      • 你应该注意rm -rf /var/lib/mysql 删除所有数据库。
      【解决方案6】:

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

      The Software Collections ( SCL ) Repository

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

      完成。

      【讨论】:

        【解决方案7】:

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

        【讨论】:

        • 我再次遇到了库问题并使用了yum upgrade mysql55-libs --downloadonly; rpm -e mysql-libs --nodeps; rpm -Uvh /var/cache/yum/&lt;REPO&gt;/mysql55-libs;,其中 是您从中下载包的任何 repo。
        【解决方案8】:
        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
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2016-02-19
          • 1970-01-01
          • 1970-01-01
          • 2018-06-07
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多