Performing an In-place Upgrade

This section describes how to perform an in-place upgrade. Review Before you Begin before proceeding.

Note

If you upgrade an installation originally produced by installing multiple RPM packages, upgrade all the packages, not just some. For example, if you previously installed the server and client RPMs, do not upgrade just the server RPM.

To perform an in-place upgrade:

  1. Review the changes described in Section 2.11.1.1, “Changes Affecting Upgrades to MySQL 5.7” for steps to be performed before upgrading.

  2. Configure MySQL to perform a slow shutdown by setting innodb_fast_shutdown to 0. For example:

    shell> bin/mysql -u root -p password --execute="set global innodb_fast_shutdown=0"

    With a slow shutdown, InnoDB performs a full purge and change buffer merge before shutting down, which ensures that data files are fully prepared in case of file format differences between releases.

  3. Shut down the old MySQL server. For example:

    shell> bin/mysqladmin -u root -p password shutdown
  4. Upgrade the MySQL binaries or packages in place, replacing the old binaries or packages with the new ones.

    Note

    For supported Linux distributions, the preferred method for replacing the MySQL packages is to use the MySQL software repositories; see Section 2.11.1.2, “Upgrading MySQL with the MySQL Yum Repository”Section 2.11.1.3, “Upgrading MySQL with the MySQL APT Repository”, or Upgrading MySQL with the MySQL SLES Repository for instructions.

  5. Start the MySQL 5.7 server, using the existing data directory. For example:

    shell> bin/mysqld_safe --user=mysql --datadir=/path/to/existing-datadir
    
  6. Run mysql_upgrade. For example:

    shell> bin/mysql_upgrade -u root -p password

    mysql_upgrade examines all tables in all databases for incompatibilities with the current version of MySQL. mysql_upgrade also upgrades the system tables so that you can take advantage of new privileges or capabilities.

    Note

    mysql_upgrade should not be used when the server is running with --gtid-mode=ON. See GTID mode and mysql_upgrade for more information.

    mysql_upgrade does not upgrade the contents of the help tables. For upgrade instructions, see Section 6.1.9, “Server-Side Help”.

Performing a Logical Upgrade

This section describes how to perform a logical upgrade. Review Before you Begin before proceeding.

To perform a logical upgrade:

  1. Review the changes described in Section 2.11.1.1, “Changes Affecting Upgrades to MySQL 5.7” for steps to be performed before upgrading.

  2. Export your existing data from the previous MySQL version:

    shell> mysqldump --add-drop-table --routines --events
    -> --all-databases --force > data-for-upgrade.sql
    Note

    Use the --routines and --events options with mysqldump (as shown above) if your databases include stored programs. The --all-databases option includes all databases in the dump, including the mysql database that holds the system tables.

    Important

    If you have tables that contain generated columns, use the mysqldump utility provided with MySQL 5.7.9 or higher to create your dump files. The mysqldump utility provided in earlier releases uses incorrect syntax for generated column definitions (Bug #20769542). You can use the INFORMATION_SCHEMA.COLUMNS table to identify tables with generated columns.

  3. Shut down the old MySQL server. For example:

    shell> bin/mysqladmin -u root -p password shutdown
  4. Install MySQL 5.7. For installation instructions, see Chapter 2, Installing and Upgrading MySQL.

  5. Initialize a new data directory:

    shell> mysqld --initialize --datadir=/path/to/5.7-datadir
    

    Copy the temporary 'root'@'localhost' password printed to your screen or written to your error log for later use.

  6. Start the MySQL 5.7 server, using the new data directory. For example:

    shell> bin/mysqld_safe --user=mysql --datadir=/path/to/5.7-datadir
    
  7. Reset the root password:

    shell> mysql -u root -p
    Enter password: **** <- enter temporary root password
    mysql> ALTER USER USER() IDENTIFIED BY 'your new password';
  8. Load the previously created dump file into the new MySQL server. For example:

    shell> bin/mysql -u root -p password --execute="source data-for-upgrade.sql" --force
  9. Run mysql_upgrade. For example:

    shell> bin/mysql_upgrade -u root -p password

    mysql_upgrade examines all tables in all databases for incompatibilities with the current version of MySQL. mysql_upgrade also upgrades the system tables so that you can take advantage of new privileges or capabilities.

    Note

    mysql_upgrade should not be used when the server is running with --gtid-mode=ON. See GTID mode and mysql_upgrade for more information.

    mysql_upgrade does not upgrade the contents of the help tables. For upgrade instructions, see Section 6.1.9, “Server-Side Help”.

  10. Configure MySQL to perform a slow shutdown by setting innodb_fast_shutdown to 0. For example:

    shell> bin/mysql -u root -p password --execute="set global innodb_fast_shutdown=0"
  11. Shut down and restart the MySQL server to ensure a clean shutdown and startup. For example:

    shell> bin/mysqladmin -u root -p password shutdown
    shell> bin/mysqld_safe --user=mysql --datadir=/path/to/5.7-datadir

Upgrade Troubleshooting

  • If problems occur, such as that the new mysqld server does not start or that you cannot connect without a password, verify that you do not have an old my.cnf file from your previous installation. You can check this with the --print-defaults option (for example, mysqld --print-defaults). If this command displays anything other than the program name, you have an active my.cnf file that affects server or client operation.

  • If, after an upgrade, you experience problems with compiled client programs, such as Commands out of sync or unexpected core dumps, you probably have used old header or library files when compiling your programs. In this case, check the date for your mysql.h file andlibmysqlclient.a library to verify that they are from the new MySQL distribution. If not, recompile your programs with the new headers and libraries. Recompilation might also be necessary for programs compiled against the shared client library if the library major version number has changed (for example from libmysqlclient.so.15 to libmysqlclient.so.16.

  • If you have created a user-defined function (UDF) with a given name and upgrade MySQL to a version that implements a new built-in function with the same name, the UDF becomes inaccessible. To correct this, use DROP FUNCTION to drop the UDF, and then use CREATE FUNCTION to re-create the UDF with a different nonconflicting name. The same is true if the new version of MySQL implements a built-in function with the same name as an existing stored function. See Section 10.2.4, “Function Name Parsing and Resolution”, for the rules describing how the server interprets references to different kinds of functions.

mysql 升级方法的更多相关文章

  1. MySQL 升级方法指南大全

    原文:MySQL 升级方法指南大全 通常,从一个发布版本升级到另一个版本时,我们建议按照顺序来升级版本.例如,想要升级 MySQL 3.23 时,先升级到 MySQL 4.0,而不是直接升级到 MyS ...

  2. 详细讲解安全升级MySQL的方法

    MySQL升级是非常必要的. 我们在Percona Support上列出了关于MySQL升级最佳实践的各种问题.这篇文章推荐了一些不同情况下升级MySQL的方法. 为什么MySQL升级是必须的? 原因 ...

  3. MySQL关闭过程详解和安全关闭MySQL的方法

    MySQL关闭过程详解和安全关闭MySQL的方法 www.hongkevip.com 时间: -- : 阅读: 整理: 红客VIP 分享到: 红客VIP(http://www.hongkevip.co ...

  4. PHPnow For ASP&&ASP.NET&&MongoDB&&MySQL支持VC6.0编译器&&MySQL升级

    可能和大家熟悉的是LAMP,Linux+Apache+Mysql+PHP,在Windows上,可能大家比较熟悉的是WAMP,Windows+Apache+Mysql+PHP,这是一个集成环境,说到集成 ...

  5. MySQL升级指南

    一 .MySQL升级 1.官方升级策略 注意 升级过程中必须使用具有管理权限的MySQL帐户来执行SQL语句. 1.升级方法 逻辑升级: 涉及使用 mysqldump从旧的MySQL版本导出现有数据 ...

  6. mysql升级的一些踩坑点

    升级的方法一般有两类: 1.利用mysqldump来直接导出sql文件,导入到新库中,这种方法最省事也最保险 缺点:大库的mysqldump费时费力. 2.直接替换掉 mysql 的安装目录和 my. ...

  7. Linux服务器上的禅道迁移及升级方法(Linux to Linux)

    由于阿里云服务器(Linux系统)到期停用,故需要将部署在该服务器上的禅道迁移到新的Linux服务器上.另外,借此机会,正好可以对旧版禅道进行一次升级.下面总结此次迁移和升级的具体操作方法. 一.禅道 ...

  8. oracle 11g RAC 补丁升级方法

    一.自动升级方法 使用auto方式在两节点分别进行PSU的安装,安装PSU前注意更新opatch工具至PSU所要求版本,p22191577补丁包括GI和DB,分别执行即可. 两节点分别grid用户执行 ...

  9. linux系统下yum 安装mysql的方法

    菜鸟一个,记录下yum 安装mysql的方法,给需要的朋友也做个参考吧. 弄了个新vps,想安装最新版的mysql,网上查了相关资料,记录如下: 1.安装查看有没有安装过:          yum ...

随机推荐

  1. HLS -- m3u8档案格式解析

    1. Playlist file 一个M3U的 Playlist 就是一个由多个独立行组成的文本文件,每行由回车/换行区分.每一行可以是一个URI.空白行或 是以”#“号开头的字符串,并且空格只能存在 ...

  2. Linux下如何进行FTP设置

    一.Redhat/CentOS安装vsftp软件 1.更新yum源 首先需要更新系统的yum源,便捷工具下载地址:http://help.aliyun.com/manual?spm=0.0.0.0.z ...

  3. Mapreduce执行过程分析(基于Hadoop2.4)——(二)

    4.3 Map类 创建Map类和map函数,map函数是org.apache.hadoop.mapreduce.Mapper类中的定义的,当处理每一个键值对的时候,都要调用一次map方法,用户需要覆写 ...

  4. 【openstack报错】【因更新包而致】IncompatibleObjectVersion: Version 1.9 of Instance is not supported

    [时间]2014年2月18日 [平台]ubuntu 12.04.3 openstack havana [日志]/var/log/upstart/nova-compute.log  内容如下: ERRO ...

  5. [POJ] #1006# Biorhythms : 最小公倍数/同余问题

    一. 题目 Biorhythms Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 127263   Accepted: 403 ...

  6. openstack-dbs

    真正的服务器派生出线程 和子进程处理多个连接当允许客户端加入聊天室,他发送的任何一条文本都将广播给聊天室中的每个用户,除非文本是服务器CLI当广播一条消息,消息前面将加上发送者的昵称 以尖括号括住昵称 ...

  7. SQL2008 SQL Server 代理服务提供的凭据无效

    工作中遇到的问题记录: 安装到服务器配置时出的错误:为 SQL Server 代理服务提供的凭据无效.若要继续操作,请为 SQL Server 代理服务提供有效的帐户和密码. 解决方法:直接在所有的“ ...

  8. STL学习系列八:Set和multiset容器

    1.set/multiset的简介 set是一个集合容器,其中所包含的元素是唯一的,集合中的元素按一定的顺序排列.元素插入过程是按排序规则插入,所以不能指定插入位置. set采用红黑树变体的数据结构实 ...

  9. KMP(http://acm.hdu.edu.cn/showproblem.php?pid=1711)

    http://acm.hdu.edu.cn/showproblem.php?pid=1711 #include<stdio.h> #include<math.h> #inclu ...

  10. 8.1搜索专练DFS和BFS

    这是第一次全部做出来的依次练习了,有一些都是做过两遍了的,但是还是错了几回,更多时候我还是应该多注意下细节,就好像章爷笑我 的一样,像什么vis[]标记没清0,什么格式错误,还有什么题目没看清,还是的 ...