设为首页 收藏本站
查看: 877|回复: 0

[经验分享] Yum升级mysql5.1到5.6

[复制链接]

尚未签到

发表于 2018-10-5 09:54:35 | 显示全部楼层 |阅读模式
  Yum升级mysql5.1到5.6
  有一些虚拟机、云主机提供商仍然使用的是老版本的安装套件。预装的应用软件版本很低。
  比如 techbrood.com 使用的云服务器,其中MySQL预装版本为老版本5.1.x。而最新的mysql版本在性能、功能、安全性等方面都有了很多的改进。
  要从最新版本获益,你需要把现有系统升级到5.5+(最新的版本是5.7),我保守一点,升级到5.6.37。
  有相关测试数据说明从5.1到5.5+,MySQL性能会有明显的提升,具体的需要自己建立测试环境去实践下。

  •   首先更新rpm
      从MySQL Yum仓库下载最新的rpm文件:http://dev.mysql.com/downloads/repo/yum/
      (需要Oracle帐号以及填写一些使用信息,才能进入下载页面)
      我需要下载的是:mysql-community-release-el6-5.noarch.rpm
  •   安装这个发布包
      yum localinstall mysql-community-release-el6-5.noarch.rpm
      可以通过下面的命令来确认这个仓库被成功添加:
      yum repolist enabled | grep "mysql.-community.

  •   安装MySQL服务器
      yum install mysql-community-server
      新版本的目标文件是/usr/bin/mysql,如果原预装路径在/bin下面,则需要进行替换,最好是使用软链接,比如ln -s /usr/bin/mysql /bin/
      这样在需要的时候,可以方便的在不同版本之间进行切换。(有时候需要版本回退来定位问题)

  • 重启服务器就可以了
      service mysqld restart
      确认版本信息:
      [root@west195246 bin]# mysql -V
      mysql  Ver 14.14 Distrib 5.6.20, for Linux (x86_64) using  EditLine wrapper
      在我进行过的几次软件升级之后,总会在 MySQL 的日志中见到“[ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it”之类的错误。虽然这个错误修复起来很简单,却不容易引起注意。可以按如下方法修复:
      错误日志如下:

      [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different>  2017-09-01 09:15:06 5588 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
      2017-09-01 09:15:06 5588 [ERROR] Plugin 'InnoDB' init function returned error.
      2017-09-01 09:15:06 5588 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
      2017-09-01 09:15:06 5588 [ERROR] Unknown/unsupported storage engine: InnoDB
      2017-09-01 09:15:06 5588 [ERROR] Aborting
      错误提示如下:
      [ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it
      [ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure
      [ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure
      [ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure
      [ERROR] Native table 'performance_schema'.'setup_consumers' has the wrong structure
      [ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure
      [ERROR] Native table 'performance_schema'.'setup_timers' has the wrong structure
      [ERROR] Native table 'performance_schema'.'performance_timers' has the wrong structure
      [ERROR] Native table 'performance_schema'.'threads' has the wrong structure
      [ERROR] Native table 'performance_schema'.'events_waits_summary_by_thread_by_event_name' has the wrong structure
      [ERROR] Native table 'performance_schema'.'events_waits_summary_by_instance' has the wrong structure
      [ERROR] Native table 'performance_schema'.'events_waits_summary_global_by_event_name' has the wrong structure
      [ERROR] Native table 'performance_schema'.'file_summary_by_event_name' has the wrong structure
      [ERROR] Native table 'performance_schema'.'file_summary_by_instance' has the wrong structure
      [ERROR] Native table 'performance_schema'.'mutex_instances' has the wrong structure
      [ERROR] Native table 'performance_schema'.'rwlock_instances' has the wrong structure
      [ERROR] Native table 'performance_schema'.'cond_instances' has the wrong structure
      [ERROR] Native table 'performance_schema'.'file_instances' has the wrong structure
      [Note] Event Scheduler: Loaded 0 events
      [Note] /usr/libexec/mysqld: ready for connections.
      Version: '5.5.20-log'  socket: '/var/lib/mysql/mysql.sock'  port: 0

  处理方法:
  #cd /var/lib/mysql
  #rm -rf ib*
  #service mysqld restart
  需要按照如下的格式在 Linux 的 —— 而不是 MySQL 的 —— 命令提示符下运行:
  #mysql_upgrade -u root -p
  然后根据提示输入 mysql 的 root 帐户密码,修复过程就可自动运行。此时会有如下形式的提示信息输出:
  mysql_upgrade -u root -p
  Enter password:
  Looking for 'mysql' as: mysql
  Looking for 'mysqlcheck' as: mysqlcheck
  Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/lib/mysql/mysql.sock'
  Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/lib/mysql/mysql.sock'
  wp_commentmeta                               OK
  wp_comments                                  OK
  wp_links                                     OK
  wp_options                                   OK
  wp_postmeta                                  OK
  wp_posts                                     OK
  wp_term_relationships                        OK
  wp_term_taxonomy                             OK
  wp_terms                                     OK
  wp_usermeta                                  OK
  wp_users                                     OK
  mysql.columns_priv                                 OK
  mysql.db                                           OK
  mysql.event                                        OK
  mysql.func                                         OK
  mysql.general_log                                  OK
  mysql.help_category                                OK
  mysql.help_keyword                                OK
  mysql.help_relation                                OK
  mysql.help_topic                                  OK
  mysql.host                                         OK
  mysql.ndb_binlog_index                             OK
  mysql.plugin                                       OK
  mysql.proc                                         OK
  mysql.procs_priv                                   OK
  mysql.servers                                     OK
  mysql.slow_log                                    OK
  mysql.tables_priv                                  OK
  mysql.time_zone                                    OK
  mysql.time_zone_leap_second                        OK
  mysql.time_zone_name                               OK
  mysql.time_zone_transition                         OK
  mysql.time_zone_transition_type                    OK
  mysql.user                                         OK
  Running 'mysql_fix_privilege_tables'...      OK
  ##service mysqld restart


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-612530-1-1.html 上篇帖子: 教您如何查看MySQL用户权限 下篇帖子: mysql按表备份脚本
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表