博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql 升级方法
阅读量:6166 次
发布时间:2019-06-21

本文共 5780 字,大约阅读时间需要 19 分钟。

Performing an In-place Upgrade

 

This section describes how to perform an . Review  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  for steps to be performed before upgrading.

  2. Configure MySQL to perform a slow shutdown by setting  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 , , or  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 . For example:

    shell> bin/mysql_upgrade -u root -p password

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

    Note

     should not be used when the server is running with . See  for more information.

     does not upgrade the contents of the help tables. For upgrade instructions, see .

     

     

     

Performing a Logical Upgrade

This section describes how to perform a . Review  before proceeding.

To perform a logical upgrade:

  1. Review the changes described in  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  and  options with  (as shown above) if your databases include stored programs. The  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  utility provided with MySQL 5.7.9 or higher to create your dump files. The  utility provided in earlier releases uses incorrect syntax for generated column definitions (Bug #20769542). You can use the  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 .

  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 -pEnter password: ****  <- enter temporary root passwordmysql> 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 . For example:

    shell> bin/mysql_upgrade -u root -p password

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

    Note

     should not be used when the server is running with . See  for more information.

     does not upgrade the contents of the help tables. For upgrade instructions, see .

  10. Configure MySQL to perform a slow shutdown by setting  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 shutdownshell> bin/mysqld_safe --user=mysql --datadir=/path/to/5.7-datadir

Upgrade Troubleshooting

  • If problems occur, such as that the new  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  option (for example, ). 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  to drop the UDF, and then use  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 , for the rules describing how the server interprets references to different kinds of functions.

转载地址:http://cpuba.baihongyu.com/

你可能感兴趣的文章
请问华为三层交换机里面的那个从IP是个什么意思? -
查看>>
kFeedback开源啦
查看>>
大数据传输,文件传输的专业解决方案!
查看>>
阿里云专家穆轩的《杭州九年程序员之“修炼”手册》
查看>>
JQuery:deferred对象的方法
查看>>
eyoucms问答 百度权重是什么
查看>>
win10中遇到qq视频时摄像头打不开没反应的解决方法
查看>>
介绍自己的一个Android插桩热修复框架项目QuickPatch
查看>>
关于textarea的ie9的maxlength不起作用的问题,请参考如下URL解决。
查看>>
Solr Facet 查询
查看>>
C++类的继承一
查看>>
数据库分库分表(sharding)系列(五) 一种支持自由规划无须数据迁移和修改路由代码的Sharding扩容方案...
查看>>
巧用VMware Workstation的clone来制作虚拟机模板
查看>>
Spring-Mybatis MapperScannerConfigurer 取不到PropertyPlaceholderConfigurer里的值
查看>>
HP DL380G4服务器前面板指示灯的含义
查看>>
数据结构_树结构
查看>>
常用URL地址
查看>>
每天一个linux命令(19):find 命令概览
查看>>
MySQL kill操作
查看>>
windows下看端口占用
查看>>