우분투에서 MySQL을 설치하고 제거하는 데 문제가 있습니다. 0 to remove and

우분투 15.04에서 부분적으로 설치된 mysql-server-5.6을 설치하거나 제거하는 데 문제가 있습니다. 내가 얻는 오류는

$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  mysql-server-5.6
The following packages will be upgraded:
  mysql-server-5.6
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
22 not fully installed or removed.
Need to get 0 B/5,501 kB of archives.
After this operation, 50.8 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Preconfiguring packages ...
Setting up mysql-common (5.6.24-0ubuntu2) ...
update-alternatives: error: alternative path                 /etc/mysql/my.cnf.fallback doesn't exist
dpkg: error processing package mysql-common (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 mysql-common
localepurge: Disk space freed in /usr/share/locale: 0 KiB
localepurge: Disk space freed in /usr/share/man: 0 KiB
localepurge: Disk space freed in /usr/share/gnome/help: 0 KiB
localepurge: Disk space freed in /usr/share/omf: 0 KiB
localepurge: Disk space freed in /usr/share/doc/kde/HTML: 0 KiB

Total disk space freed by localepurge: 0 KiB

E: Sub-process /usr/bin/dpkg returned an error code (1)

누군가 나를 도울 수 있습니까?



답변

제거를 시도한 후 다시 설치하십시오.

sudo apt-get remove --purge mysql-\*
sudo apt-get install mysql-server mysql-client

04.09.2018 업데이트 :
MySQL 프로세스가 활성화되어 제거 / 설치에 문제가있는 경우 먼저 다음을 시도하십시오.
sudo kill $(pgrep mysql)


답변

내가 (리눅스 멍청한 놈) 파헤쳐 야했던 매우 간단한 해결책은 파일을 만드는 것입니다.

nano /etc/mysql/my.cnf.fallback

mysql-common 5.7.11-0ubuntu6 패키지의 기본 내용으로 채우십시오.

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

!includedir /etc/mysql/conf.d/

apt-browse.org에서 찾을 수 있습니다


답변

제거 / 다시 설치도 작동하지 않습니다. 다음과 같은 “솔루션”을 찾았습니다.

mysql.cnf.fallback“제공된 파일”에서 파일에 대한 mysql-server-5.6/ mysql-client-5.6또는 추가 정보를 찾을 수 없습니다 .

나는 이것을 복사 /etc/mysql/my.cnf했다 /etc/mysql/my.cnf.fallback(이것이 상대적으로 덜 중요한 “대체”설정 파일 일 것이라고 추측);

/etc/mysql/my.cnf는 심볼릭 링크이므로 다음을 ls /etc/mysql보여줍니다.

 my.cnf.fallback -> /etc/alternatives/my.cnf
 my.cnf -> /etc/alternatives/my.cnf

그런 다음 패키지 설치가 오류없이 완료되었습니다 ( “존재하지 않음”문제가 “해결됨”).

나는 어떤 부작용도 겪지 않았습니다 (아직).


답변

mysql-server (5.7.14)를 제거하는 동안 동일한 문제가 발생했습니다.

my.cnf * 파일이 누락 된 경우 mysql-common 패키지를 다시 설치 한 후 ( mysql-server & mysql-common ) 패키지를 모두 제거 할 수 있습니다.

이 my.cnf * 파일은 mysql-common 패키지에 속합니다 (아래 참조).

$ dpkg -L mysql-common | grep cnf
/etc/mysql/my.cnf.fallback
/etc/mysql/conf.d/mysql.cnf

1. mysql-common을 다시 설치 하십시오

apt-get install –mysql-common을 다시 설치하십시오

  1. mysql-common 제거

apt-get 퍼지 mysql-common


답변

/etc/mysql/폴더를 확인한 후 빈 하위 폴더가 아닌 완전히 비어있는 것으로 나타났습니다 conf.d.

cd /etc/
# you need to delete the empty mysql folder otherwise the ln below creates the link inside the existing mysql folder
sudo rm -r mysql
sudo ln -s ./mysql.bak/ mysql

그런 다음 (이 링크 제공 이 링크 )

sudo dpkg --configure -a

이제 모두 괜찮아 보입니다.

위의 링크에도 언급되어 --force-depends있지만 필요하지 않습니다. 또한 언급 apt-get -f install하지만 다시는 필요하지 않았습니다.


답변

주석에서 charneykaye가 언급했듯이 백그라운드에서 일부 mysql프로세스가 있으면이 방법이 실패 할 수 있습니다 . 나는 사용했다 :

emil-mint-desktop ~ # ps -aef | grep mysql
root      6682     1  0 16:45 ?        00:00:00 sudo mysqld_safe --skip-grant-tables
root      6683  6682  0 16:45 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --skip-grant-tables
mysql     7046  6683  0 16:45 ?        00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --skip-grant-tables --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306 --log-syslog=1 --log-syslog-facility=daemon --log-syslog-tag=
root     21046  9812  0 17:32 pts/5    00:00:00 grep --color=auto mysql

다음을 사용하여 처음 3 개의 프로세스를 종료했습니다 (마지막 프로세스는 grep호출 자체입니다).

kill -9 6682 8883 7046

그런 다음 mysql관련된 모든 것을 제거하십시오 .

apt remove --purge mysql-\*
apt autoremove
apt autoclean

그런 다음 설치하십시오.

apt install mysql-server

그런 다음 효과가있었습니다.

버전 :

  • 민트 18.1 (우분투 기반). 당신은 대체해야합니다 apt에 대한 apt-get몇 가지 다른 버전.

답변

나는 그것을위한 쉬운 해결책을 찾았다.

첫 번째 단계: apt-get install mysql-common --reinstall

두번째 단계: apt-get install mysql-server --reinstall

그리고 작동합니다!