備忘録
インストールしたい
前のMySQLの残骸を削除して再インストールしたい
$sudo apt-get install mysql-server-5.7
エラー おそらくその前に色々依存関係のあるものをインストールしたのが原因
mariadb関連
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libdbd-mysql-perl libdbi-perl libreadline5 mariadb-common
Use 'sudo apt autoremove' to remove them.
Suggested packages:
mailx tinyca
The following NEW packages will be installed:
mysql-server-5.7
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
3 not fully installed or removed.
Need to get 2,726 kB of archives.
After this operation, 48.3 MB of additional disk space will be used.
Get:1 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-server-5.7 amd64 5.7.24-0ubuntu0.16.04.1 [2,726 kB]
Fetched 2,726 kB in 0s (3,599 kB/s)
Preconfiguring packages ...
(Reading database ... 70381 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.24-0ubuntu0.16.04.1_amd64.deb ...
Aborting downgrade from (at least) 10.0 to 5.7.
If are sure you want to downgrade to 5.7, remove the file
/var/lib/mysql/debian-*.flag and try installing again.
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.7_5.7.24-0ubuntu0.16.04.1_amd64.deb (--unpack):
subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/mysql-server-5.7_5.7.24-0ubuntu0.16.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
綺麗にしていく
$sudo apt-get remove --purge mysql-server mysql-client mysql-common && sudo apt-get autoremove && sudo apt-get autoclean && sudo deluser mysql && sudo rm -rf /var/lib/mysql && sudo apt-get purge mysql-server-core-5.7 && sudo apt-get purge mysql-client-core-5.7 && sudo rm -rf /var/log/mysql && sudo rm -rf /etc/mysql
ディストリビューションをアップグレード
$sudo apt-get dist-upgrade
再びインストール
$sudo apt-get install mysql-server-5.7
パスワードを設定する画面が現れる 成功!!