热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

如果线上的mysql升级怎样做_MySQL升级问题

今天做了MySQL升级,从5.1.26-rc升级到5.5.15,都是从官网下载的源码包进行编译的,其中MySQL5.5.15是由我的同事提

今天做了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 release. Please use '--slow-query-log'/'--slow-query-log-file' instead.

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, size = 1000.0M

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升级有很多种方法,我个人选择了导入导出的方法,如果有读者对其他的方式感兴趣,可以做相关尝试。

以上是升级过程中的相关问题,做了简单总结,适合初学者。



推荐阅读
  • 本文介绍了数据库的存储结构及其重要性,强调了关系数据库范例中将逻辑存储与物理存储分开的必要性。通过逻辑结构和物理结构的分离,可以实现对物理存储的重新组织和数据库的迁移,而应用程序不会察觉到任何更改。文章还展示了Oracle数据库的逻辑结构和物理结构,并介绍了表空间的概念和作用。 ... [详细]
  • 云原生边缘计算之KubeEdge简介及功能特点
    本文介绍了云原生边缘计算中的KubeEdge系统,该系统是一个开源系统,用于将容器化应用程序编排功能扩展到Edge的主机。它基于Kubernetes构建,并为网络应用程序提供基础架构支持。同时,KubeEdge具有离线模式、基于Kubernetes的节点、群集、应用程序和设备管理、资源优化等特点。此外,KubeEdge还支持跨平台工作,在私有、公共和混合云中都可以运行。同时,KubeEdge还提供数据管理和数据分析管道引擎的支持。最后,本文还介绍了KubeEdge系统生成证书的方法。 ... [详细]
  • 如何去除Win7快捷方式的箭头
    本文介绍了如何去除Win7快捷方式的箭头的方法,通过生成一个透明的ico图标并将其命名为Empty.ico,将图标复制到windows目录下,并导入注册表,即可去除箭头。这样做可以改善默认快捷方式的外观,提升桌面整洁度。 ... [详细]
  • Mac OS 升级到11.2.2 Eclipse打不开了,报错Failed to create the Java Virtual Machine
    本文介绍了在Mac OS升级到11.2.2版本后,使用Eclipse打开时出现报错Failed to create the Java Virtual Machine的问题,并提供了解决方法。 ... [详细]
  • 本文介绍了在Mac上搭建php环境后无法使用localhost连接mysql的问题,并通过将localhost替换为127.0.0.1或本机IP解决了该问题。文章解释了localhost和127.0.0.1的区别,指出了使用socket方式连接导致连接失败的原因。此外,还提供了相关链接供读者深入了解。 ... [详细]
  • Go GUIlxn/walk 学习3.菜单栏和工具栏的具体实现
    本文介绍了使用Go语言的GUI库lxn/walk实现菜单栏和工具栏的具体方法,包括消息窗口的产生、文件放置动作响应和提示框的应用。部分代码来自上一篇博客和lxn/walk官方示例。文章提供了学习GUI开发的实际案例和代码示例。 ... [详细]
  • IhaveconfiguredanactionforaremotenotificationwhenitarrivestomyiOsapp.Iwanttwodiff ... [详细]
  • 知识图谱——机器大脑中的知识库
    本文介绍了知识图谱在机器大脑中的应用,以及搜索引擎在知识图谱方面的发展。以谷歌知识图谱为例,说明了知识图谱的智能化特点。通过搜索引擎用户可以获取更加智能化的答案,如搜索关键词"Marie Curie",会得到居里夫人的详细信息以及与之相关的历史人物。知识图谱的出现引起了搜索引擎行业的变革,不仅美国的微软必应,中国的百度、搜狗等搜索引擎公司也纷纷推出了自己的知识图谱。 ... [详细]
  • 图解redis的持久化存储机制RDB和AOF的原理和优缺点
    本文通过图解的方式介绍了redis的持久化存储机制RDB和AOF的原理和优缺点。RDB是将redis内存中的数据保存为快照文件,恢复速度较快但不支持拉链式快照。AOF是将操作日志保存到磁盘,实时存储数据但恢复速度较慢。文章详细分析了两种机制的优缺点,帮助读者更好地理解redis的持久化存储策略。 ... [详细]
  • 本文介绍了Perl的测试框架Test::Base,它是一个数据驱动的测试框架,可以自动进行单元测试,省去手工编写测试程序的麻烦。与Test::More完全兼容,使用方法简单。以plural函数为例,展示了Test::Base的使用方法。 ... [详细]
  • 本文讨论了在数据库打开和关闭状态下,重新命名或移动数据文件和日志文件的情况。针对性能和维护原因,需要将数据库文件移动到不同的磁盘上或重新分配到新的磁盘上的情况,以及在操作系统级别移动或重命名数据文件但未在数据库层进行重命名导致报错的情况。通过三个方面进行讨论。 ... [详细]
  • 本文详细介绍了MySQL表分区的创建、增加和删除方法,包括查看分区数据量和全库数据量的方法。欢迎大家阅读并给予点评。 ... [详细]
  • CentOS 6.5安装VMware Tools及共享文件夹显示问题解决方法
    本文介绍了在CentOS 6.5上安装VMware Tools及解决共享文件夹显示问题的方法。包括清空CD/DVD使用的ISO镜像文件、创建挂载目录、改变光驱设备的读写权限等步骤。最后给出了拷贝解压VMware Tools的操作。 ... [详细]
  • 本文介绍了将mysql从5.6.15升级到5.7.15的详细步骤,包括关闭访问、备份旧库、备份权限、配置文件备份、关闭旧数据库、安装二进制、替换配置文件以及启动新数据库等操作。 ... [详细]
  • MongoDB用户验证auth的权限设置及角色说明
    本文介绍了MongoDB用户验证auth的权限设置,包括readAnyDatabase、readWriteAnyDatabase、userAdminAnyDatabase、dbAdminAnyDatabase、cluster相关的权限以及root权限等角色的说明和使用方法。 ... [详细]
author-avatar
陈俊英围脖_687
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有