我必须重新安装服务器,才能获取 /var、/usr 和 /etc 目录。重新安装服务器后,我安装了 mysql 和 phpmyadmin。之后,我尝试将数据库文件放回新服务器。所有表都正常,但当我将用户表转移到 mysql 数据库中时,我开始收到错误,然后我无法使用“service mysql reload”命令,因为服务器无法识别任何密码。因此,我决定删除 mysql 并重新安装它。不幸的是,从那时起我一直遇到麻烦,dpkg 无法配置包,因此我从 /var 和 /etc 中删除了 mysql 文件夹...现在 dpkg 说,
root@thegamingcorner:~# apt-get -f install mysql-server-5.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server-5.6 is already the newest version.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up mysql-server-5.6 (5.6.25-0ubuntu0.15.04.1) ...
update-alternatives: error: alternative path /etc/mysql/mysql.cnf doesn't exist
dpkg: error processing package mysql-server-5.6 (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.6; however:
Package mysql-server-5.6 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates it's a follow-up error from a previous failure.
Errors were encountered while processing:
mysql-server-5.6
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)"
This happens everytime I try to remove, purge, reinstall, or install the package, I looked through some of the similar problems and no answers worked, so far I have tried:
"dpkg --configure -a"
"apt-get install mysql-server --reinstall"
"apt-get remove --purge mysql-server"
"dpkg --purge mysql-server"
说实话,我被困住了,不知道该怎么办。另外,如果有不在 mysql 文件夹中的日志,请告诉我在哪里可以找到它们,以便我可以发布它。
答案1
好吧,我尝试了其他方法,我所做的是从旧版本复制备份的 /etc/mysql 文件夹,将 my.cnf 重命名为 mysql.cnf,然后运行
root@thegamingcorner:~# dpkg --configure -a
Setting up mysql-server-5.6 (5.6.25-0ubuntu0.15.04.1) ...
update-alternatives: warning: alternative /etc/mysql/my.cnf.fallback (part of link group my.cnf) doesn't exist; removing from list of alternatives
update-alternatives: warning: forcing reinstallation of alternative /etc/mysql/mysql.cnf because link group my.cnf is broken
2015-09-28 10:40:02 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2015-09-28 10:40:02 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-09-28 10:40:02 0 [Note] /usr/sbin/mysqld (mysqld 5.6.25-0ubuntu0.15.04.1) starting as process 9669 ...
Setting up mysql-server (5.6.25-0ubuntu0.15.04.1) ...
之后,我能够成功清除并重新安装 mysql。