ubuntu15.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)
誰かこれについて助けてくれませんか?
答え1
パージを実行してから再インストールしてください。
sudo apt-get remove --purge mysql-\*
sudo apt-get install mysql-server mysql-client
2018 年 9 月 4 日更新:
MySQL プロセスが稼働しているためにアンインストール/インストールに問題がある場合は、まずこれを試してから、上記を試してください。
sudo kill $(pgrep mysql)
答え2
私 (Linux 初心者) が見つけなければならなかった非常に簡単な解決策は、ファイルを作成することです。
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はこちら
答え3
パージ/再インストールも機能しませんでした。次の「解決策」を見つけました:
/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
その後、パッケージのインストールはエラーなしで完了しました (おそらく「存在しない」問題が「解決」されたため)。
今のところ、副作用は出ていません。
答え4
確認しました。順序は重要です。
apt remove mysql-* mariadb-* --purge
apt install mysql-common
apt install mariadb-common
apt install mariadb-server