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

[经验分享] MySQL升级问题

[复制链接]

尚未签到

发表于 2018-10-3 10:56:45 | 显示全部楼层 |阅读模式
  今天做了MySQL升级,从 5.1.26-rc 升级 到 5.5.15,都是从官网下载的源码包进行编译的,其中MySQL 5.5.15是由我的同事提供的
  由于现有数据库采用innodb的引擎,故采用mysqldump导出备份,然后再导入备份的方式进行升级
  升级大致步骤准备:
  1、对现有数据库做备份
  2、对现有的MySQL程序重命名(防止升级失败还能恢复)
  3、对现有权限库做单独备份
  4、替换现有MySQL程序
  5、启动MySQL 5.5.15,导入备份
  注:特别注意mysql日志提示
  在升级后启动MySQL 5.5.15的过程中遇到很多提示错误,根据错误提示加以修改,很快解决问题。
  a、我所安装升级的MySQL 5.5.15,编译目录选择的是/usr/local/mysql,但是我们线上的数据库程序所在目录为/usr/local/mysql5,我按照线上的进行升级,也将程序按照线上服务部署,故在启动的过程中提示如下错误:
  120717 11:19:41 mysqld_safe The file /usr/local/mysql/bin/mysqld
  does not exist or is not executable. Please cd to the mysql installation
  directory and restart this script from there as follows:
  ./bin/mysqld_safe&
  See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information
  解决方法:将程序目录更改为/usr/local/mysql
  b、配置文件中有[mysqld]选项段有如下选项--log-slow-queries,这个选项属于老版本的选项,根据mysql日志文件GY_ZGC_97.err错误提示加以修改:
  120717 11:21:32 mysqld_safe Starting mysqld daemon with databases from /home/mysql/data

  120717 11:21:32 [Warning] The syntax '--log-slow-queries' is deprecated and will be removed in a future>  120717 11:21:32 InnoDB: The InnoDB memory heap is disabled
  120717 11:21:32 InnoDB: Mutexes and rw_locks use InnoDB's own implementation
  120717 11:21:32 InnoDB: Compressed tables use zlib 1.2.3

  120717 11:21:33 InnoDB: Initializing buffer pool,>  120717 11:21:33 InnoDB: Completed initialization of buffer pool
  解决方法:将配置文件中的log-slow-queries替换为slow-query-log
  c、mysql启动有个选项--datadir,该选项指定的目录没有权限问题:
  120717 11:21:33  InnoDB: Operating system error number 13 in a file operation.
  InnoDB: The error means mysqld does not have the access rights to
  InnoDB: the directory.
  InnoDB: File name ./ibdata1
  InnoDB: File operation call: 'create'.
  InnoDB: Cannot continue operation.
  120717 11:21:33 mysqld_safe mysqld from pid file /home/mysql/data/GY_ZGC_97.pid ended
  解决方法:将mysql数据目录属主更改为mysql用户:chown -R mysql.mysql data
  d、mysql配置文件有如下选项:default-character-set=utf8
  120717 11:22:46 InnoDB: 1.1.8 started; log sequence number 0
  120717 11:22:46 [ERROR] /usr/local/mysql/bin/mysqld: unknown variable 'default-character-set=utf8'
  120717 11:22:46 [ERROR] Aborting
  120717 11:22:46  InnoDB: Starting shutdown...
  120717 11:22:47  InnoDB: Shutdown completed; log sequence number 1595675
  120717 11:22:47 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
  120717 11:22:47 mysqld_safe mysqld from pid file /home/mysql/data/GY_ZGC_97.pid ended
  解决方法:注释掉该选项
  e、mysql权限库直接用的原来的权限库,有如下错误提示:
  120717 11:25:00 [ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'events_waits_current' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'events_waits_history' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'events_waits_history_long' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'setup_consumers' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'setup_instruments' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'setup_timers' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'performance_timers' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'threads' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_thread_by_event_name' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'events_waits_summary_by_instance' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'events_waits_summary_global_by_event_name' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'file_summary_by_event_name' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'file_summary_by_instance' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'mutex_instances' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'rwlock_instances' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'cond_instances' has the wrong structure
  120717 11:25:00 [ERROR] Native table 'performance_schema'.'file_instances' has the wrong structure
  解决方法:根据提示只需要运行bin/mysql_upgrade,类似如下命令(特别注意:本地在启动多个数据库的情况下,需要通过--sock制定要访问的数据库)
  [root@245 mysql]# bin/mysql_upgrade --sock=/tmp/mysql_log.sock -p
  Enter password:
  Looking for 'mysql' as: ./mysql
  Looking for 'mysqlcheck' as: ./mysqlcheck
  Running 'mysqlcheck' with connection arguments: '--socket=/tmp/mysql_log.sock'
  Running 'mysqlcheck' with connection arguments: '--socket=/tmp/mysql_log.sock'
  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
  对于MySQL升级有很多种方法,我个人选择了导入导出的方法,如果有读者对其他的方式感兴趣,可以做相关尝试。
  以上是升级过程中的相关问题,做了简单总结,适合初学者。


运维网声明 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.yunweiku.com/thread-608975-1-1.html 上篇帖子: MySQL 行复制 下篇帖子: mysql数据同步
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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