当我们这样做时:
# apt-get install mysql-server-5.6
我们得到的是 5.6.28 版本。我们已经使用 5.6.19 测试并认证了我们的应用,由于 5.6.20 中所做的更改,我们甚至无法在 5.6.28 中创建架构。
问题是,如何在服务器上安装 5.6.19?我们尝试了以下方法:
# apt-get install mysql-server-5.6=5.6.19
但这不起作用,大概我们需要其他版本字符串,例如“5.6.19_ubuntu_amd”或类似的。
仅供参考,我正在尝试替换 5.6.28。我删除了这个版本,如下所示:
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
按照 techraf 的出色说明,我进入了第 3 步,然后出现错误:
# dpkg -i mysql-community-server_5.6.19-1ubuntu14.04_*.deb
Selecting previously unselected package mysql-community-server.
(Reading database ... 15049 files and directories currently installed.)
Preparing to unpack mysql-community-server_5.6.19-1ubuntu14.04_amd64.deb ...
Unpacking mysql-community-server (5.6.19-1ubuntu14.04) ...
dpkg: dependency problems prevent configuration of mysql-community-server:
mysql-community-server depends on libaio1 (>= 0.3.93); however:
Package libaio1:amd64 is not installed.
dpkg: error processing package mysql-community-server (--install):
dependency problems - leaving unconfigured
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing:
mysql-community-server
这样做:
# apt-get install libaio1
得到:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libaio1
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/6,364 B of archives.
After this operation, 53.2 kB of additional disk space will be used.
Selecting previously unselected package libaio1:amd64.
(Reading database ... 15134 files and directories currently installed.)
Preparing to unpack .../libaio1_0.3.109-4_amd64.deb ...
Unpacking libaio1:amd64 (0.3.109-4) ...
Setting up libaio1:amd64 (0.3.109-4) ...
Setting up mysql-community-server (5.6.19-1ubuntu14.04) ...
No directory, logging in with HOME=/
......
* MySQL Community Server 5.6.19 is started
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
Processing triggers for ureadahead (0.100.0-16) ...
不知何故,服务器在安装后运行,但如果我重新启动它,例如
# service mysql restart
我得到:
* Stopping MySQL Community Server 5.6.19
* MySQL Community Server 5.6.19 is stopped
* Re-starting MySQL Community Server 5.6.19
No directory, logging in with HOME=/
* MySQL Community Server 5.6.19 did not start. Please check logs for more details.
日志文件中没有错误。
谷歌搜索后,人们说这是在权限不正确时发生的。mysql deb 包不知道如何安装正确的权限,这很奇怪。这样做:
# ls -ld /var/run/mysqld
drwxr-xr-x 2 mysql root 80 Apr 4 02:50 /var/run/mysqld
这看起来与正确安装的旧服务器相同,因此没有什么乐趣。
检查 /etc/passwd,我们看到:
mysql:x:103:106:MySQL Server,,,:/nonexistent:/bin/false
这与 5.6.19 版本的安装完全相同。此技巧:
# usermod -d /var/lib/mysql/ mysql
似乎已经修复了。
我感觉 mysql 从来没有被设计用于安装以前的版本,只用于安装当前版本,在他们做出重大改变之前这都是没问题的。
答案1
去MySQL 社区服务器(存档版本)下载网站
选择
Select Version: 5.6.19
选择
Select Platform: Ubuntu Linux
下载
mysql-server_5.6.19-1ubuntu14.04_*.deb-bundle.tar
适合您的架构的安塔尔
tar -xvf mysql-server_5.6.19-1ubuntu14.04_*.deb-bundle.tar
跟着详细说明安装和配置单个包:
sudo dpkg -i mysql-common_5.6.19-1ubuntu14.04_*.deb
sudo dpkg-preconfigure mysql-community-server_5.6.19-1ubuntu14.04_*.deb
(提供用户密码root
)sudo apt-get install libaio1
(如果下一步显示错误则必需):mysql-community-server 依赖于 libaio1 (>= 0.3.93);但是:
软件包 libaio1 未安装。sudo dpkg -i mysql-community-server_5.6.19-1ubuntu14.04_*.deb
sudo dpkg -i mysql-community-client_5.6.19-1ubuntu14.04_*.deb
sudo dpkg -i libmysqlclient18_5.6.19-1ubuntu14.04_*.deb