欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

MySQL从 5.1.26-rc 升级 到 5.5.15

程序员文章站 2022-06-14 10:54:45
...

今天做了MySQL升级,从 5.1.26-rc 升级 到 5.5.15,都是从官网下载的源码包进行编译的,其中MySQL 5.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 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

解决方法:注释掉该选项

MySQL从 5.1.26-rc 升级 到 5.5.15