MySQL을 설치하거나 제거 할 수 없습니다

그래서 오늘 MariaDB를 설치하여 phpmyadmin을 통해 로그인 할 수 있었지만 분명히 작동하지 않았으므로 제거하고 4 번처럼 다시 시도했지만 실패했습니다. 대신 MySQL 서버를 사용하기로 결정했습니다. MariaDB를 제거한 후 설치할 수 없습니다.

여기 내가하려는 일과 출력이 있습니다.

shavit@dedi:~$ sudo apt-get install mysql-server
[sudo] password for shavit:
Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-server is already the newest version (5.7.12-0ubuntu1).
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.7 (5.7.12-0ubuntu1) ...
mysql_upgrade: Got error: 1524: Plugin 'unix_socket' is not loaded while connect                                                                                                                                                             ing to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 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 er                                                                                                                                                             ror from a previous failure.
                            Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

shavit@dedi:~$ sudo apt-get remove mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libaio1 mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7
  mysql-server-core-5.7
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED
  mysql-server
0 to upgrade, 0 to newly install, 1 to remove and 0 not to upgrade.
2 not fully installed or removed.
After this operation, 159 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 35749 files and directories currently installed.)
Removing mysql-server (5.7.12-0ubuntu1) ...
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
mysql_upgrade: Got error: 1524: Plugin 'unix_socket' is not loaded while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)

나는 지금 정말로 길을 잃었다. 인터넷 검색은 내가 달려야한다고 나에게 말했다 apt-get install -f.

shavit@dedi:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
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.
Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ...
mysql_upgrade: Got error: 1524: Plugin 'unix_socket' is not loaded while connecting to the MySQL server
Upgrade process encountered error and will not continue.
mysql_upgrade failed with exit status 11
No apport report written because the error message indicates it's a follow-up error from a previous failure.
                                                                                                            dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

그래서 나는 달리고 sudo apt-get autoremove다시 설치를 진행했다.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.23-0ubuntu3) ...
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.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

나는 리눅스, 특히 우분투와 관련된 것을 가진 초보자입니다. 누구든지 손을 빌려주고 도와 줄 수 있습니까? 매우 감사!



답변

MariaDB를 설치했다는 사실 때문에이 문제가 발생했다고 생각합니다. MariaDB가 설정 한 구성은 바닐라 MySQL에서 정확하게 작동하지 않습니다. 이전 구성을 모두 제거하고 모든 것을 처음부터 설정했다면 제대로 작동합니다. 이것은 현재 DB를 삭제합니다! 중요한 데이터를 백업하십시오.

다음 명령을 실행하여 모든 MySQL 관련 항목을 재설정하고 제거하십시오.

sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server

이 작업이 완료되면 아래를 실행하여 시스템을 업데이트하고 패키지 캐시를 “정리”하십시오.

sudo apt update && sudo apt dist-upgrade && sudo apt autoremove && sudo apt -f install

그런 다음 MySQL 서버를 다시 설치하십시오.

sudo apt install mysql-server

답변

이 오류는 mariadb-server이전에 설치할 때 발생할 수 있습니다 mysql-server. 이 오류를 해결하려면, 당신은 디렉토리를 삭제해야 /var/lib/mysql*하고 /etc/mysql*다시 MySQL을 설치하기 전에, 모든 구성 및 종속성 파일을 제거 할 수 있습니다.

sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server
sudo apt update && sudo apt dist-upgrade && sudo apt autoremove && sudo apt -f install
sudo apt install mysql-server