Yum升级mysql5.1到5.6

Yum升级MysqL5.1到5.6

有一些虚拟机、云主机提供商仍然使用的是老版本的安装套件。预装的应用软件版本很低。
比如techbrood.com使用的云服务器,其中MysqL预装版本为老版本5.1.x。而最新的MysqL版本在性能功能、安全性等方面都有了很多的改进。
要从最新版本获益,你需要把现有系统升级到5.5+(最新的版本是5.7),我保守一点,升级到5.6.37。
有相关测试数据说明从5.1到5.5+,MysqL性能会有明显的提升,具体的需要自己建立测试环境去实践下。

  1. 首先更新rpm
    MysqL Yum仓库下载最新的rpm文件http://dev.mysql.com/downloads/repo/yum/
    (需要Oracle帐号以及填写一些使用信息,才能进入下载页面
    我需要下载的是:MysqL-community-release-el6-5.noarch.rpm

  2. 安装这个发布包

    yum localinstall MysqL-community-release-el6-5.noarch.rpm
    可以通过下面的命令来确认这个仓库被成功添加
    yum repolist enabled | grep "MysqL.-community.

  3. 安装MysqL服务器

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

  4. 重启服务器就可以了

    service MysqLd restart
    确认版本信息:
    [root@west195246 bin]# MysqL -V
    MysqL Ver 14.14 distrib 5.6.20,forLinux(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 size 640 pages (rounded down to MB) than specified in the .cnf file: initial 16384 pages,max 0 (relevant if non-zero) pages!
    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 -pEnter password:Looking for 'MysqL' as: MysqLLooking for 'MysqLcheck' as: MysqLcheckRunning '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 OKwp_comments OKwp_links OKwp_options OKwp_postMeta OKwp_posts OKwp_term_relationships OKwp_term_taxonomy OKwp_terms OKwp_userMeta OKwp_users OKMysqL.columns_priv OKMysqL.db OKMysqL.event OKMysqL.func OKMysqL.general_log OKMysqL.help_category OKMysqL.help_keywordOKMysqL.help_relation OKMysqL.help_topic OKMysqL.host OKMysqL.ndb_binlog_index OKMysqL.plugin OKMysqL.proc OKMysqL.procs_priv OKMysqL.servers OKMysqL.slow_log OKMysqL.tables_priv OKMysqL.time_zone OKMysqL.time_zone_leap_second OKMysqL.time_zone_name OKMysqL.time_zone_transition OKMysqL.time_zone_transition_type OKMysqL.user OKRunning 'MysqL_fix_privilege_tables'... OK##service MysqLd restart

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...