在 CentOS 6 中将 MySQL 5.7 降级到 5.1

在 CentOS 6 中将 MySQL 5.7 降级到 5.1

我之前安装了MySQL内置5.1并且运行良好。今天,我关注了本文并安装了5.7。不幸的是,我的虚拟机内存有限(512mb),5.7 无法启动。我想将 MySQL 降级到我的工作版本 5.1。

我确实通过使用yum remove mysql成功删除了5.7。但是之后:

# yum download mysql
No Match for available package: mysql-5.1.73-8.el6_8.i686
Nothing to do

如果我运行yum install mysql,它会再次重新安装 5.7 版本。如何重新安装 mysql 5.1?

从文件 mysqld.log.rpmsave 记录

170620 23:48:04  InnoDB: Starting shutdown...
170620 23:48:10  InnoDB: Shutdown completed; log sequence number 0 34058928
170620 23:48:10 [Note] 
170620 23:48:10 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
170620 23:54:27 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
170620 23:54:27 [ERROR] Can't read from messagefile '/usr/share/mysql/english/errmsg.sys'
170620 23:54:27  InnoDB: Initializing buffer pool, size = 8.0M
170620 23:54:27  InnoDB: Completed initialization of buffer pool
170620 23:54:27  InnoDB: Started; log sequence number 0 34058928
170620 23:54:27 [ERROR] /usr/libexec/mysqld: unknown variable 'innodb_large_prefix=true'
170620 23:54:27 [ERROR] Aborting

170620 23:54:27  InnoDB: Starting shutdown...
170620 23:54:32  InnoDB: Shutdown completed; log sequence number 0 34058928
170620 23:54:32 [Note] 
170620 23:54:32 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

从文件消息记录

Jun 21 00:46:03 vpn1UgoVPNcom kernel: Out of memory: Kill process 31276 (mysqld) score 162 or sacrifice child
Jun 21 00:46:03 vpn1UgoVPNcom kernel: Killed process 31276, UID 0, (mysqld) total-vm:126948kB, anon-rss:98224kB, file-rss:8kB

没有这样的文件 mysqld.err ,而且 Mysqld.log 是空的

尝试启动 MySQL 5.7

[root@vpn1UgoVPNcom home]# service mysqld start
/usr/bin/mysqld_safe: line 196:  9475 Killed                  nohup /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock < /dev/null > /dev/null 2>&1
MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

答案1

我运行了以下命令,它回到了 5.1 并且现在运行良好:

yum remove 'mysql*'
yum install mysql-server-5.1*
service mysqld start

答案2

那篇文章让您添加了 Oracle 社区 MySQL 存储库,其软件包废弃了库存软件包。您需要首先禁用该存储库(yum-config-manager --disable mysql57-community或编辑 /etc/yum.repos.d 中的文件),然后您可以再次从库存存储库安装库存 5.1 版本。

答案3

您可以从以下链接下载 RPM 并使用 RPM install 命令进行安装:

rpm -ivh mysql-5.1.73-8.el6_8.x86_64.rpm

下载链接: https://centos.pkgs.org/6/centos-x86_64/mysql-5.1.73-8.el6_8.x86_64.rpm.html

相关内容