web-dev-qa-db-ja.com

mariaDBとの愚かな衝突の後でMySQLをインストールできない

MySQLがこの特定のコンピューターに既にインストールされており、MariaDBをインストールしたことは完全に気になりませんでした。同じコンピューターに両方のパッケージがあることの結果にも気づかず、両方のインストールを完全にアンインストールし、両方の依存関係を削除しようとしましたそのうちの。これを行う方法に関するいくつかのチュートリアルをオンラインで探しましたが、まだMySQLの実行に問題があります。以下に、ターミナルウィンドウのスクリーンキャプチャと、私が試した多くの試行済みソリューションのリストがあります。残念ながら、試行した順序を思い出せないほど多く試行したため、MySQLのインストールが機能したいだけなのに、以前のインストールから削除できないものがあり、MySQLのインストールが機能していません。 dpkg:警告を取得します。どんな助けも非常に高く評価されます。 (Ubuntu 20.04)

これは、端末ウィンドウの画面取りです。

homeserver@ubuserv:~/Desktop$ ps ax | grep mysql
   4958 pts/0    S+     0:00 grep --color=auto mysql
homeserver@ubuserv:~/Desktop$ Sudo mysql_secure_installation utility
[Sudo] password for homeserver: 

Securing the MySQL server deployment.

Enter password for user root: 
Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
homeserver@ubuserv:~/Desktop$ mysql --version
mysql  Ver 8.0.20-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))
homeserver@ubuserv:~/Desktop$ Sudo systemctl stop mysql
Failed to stop mysql.service: Unit mysql.service not loaded.
homeserver@ubuserv:~/Desktop$ Sudo systemctl stop mysql
Failed to stop mysql.service: Unit mysql.service not loaded.
homeserver@ubuserv:~/Desktop$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
homeserver@ubuserv:~/Desktop$ Sudo apt install synaptic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
synaptic is already the newest version (0.84.6ubuntu5).
The following packages were automatically installed and are no longer required:
  hplip-data printer-driver-postscript-hp python3-renderpm
  python3-reportlab python3-reportlab-accel
Use 'Sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.

homeserver@ubuserv:~/Desktop$ Sudo service mysql restart
[Sudo] password for homeserver: 
Failed to restart mysql.service: Unit mysql.service not found.
homeserver@ubuserv:~/Desktop$ apt search mysql | grep "\[install"
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libdbi-Perl/focal,now 1.643-1 AMD64 [installed]
libmysqlclient21/focal-updates,focal-security,now 8.0.20-0ubuntu0.20.04.1 AMD64 [installed]
librdf0/focal,now 1.0.17-1.1ubuntu1 AMD64 [installed,automatic]
mysql-client-8.0/focal-updates,focal-security,now 8.0.20-0ubuntu0.20.04.1 AMD64 [installed]
mysql-client-core-8.0/focal-updates,focal-security,now 8.0.20-0ubuntu0.20.04.1 AMD64 [installed]
mysql-common/focal,focal,now 5.8+1.0.5ubuntu2 all [installed]
mysql-server/focal-updates,focal-updates,focal-security,focal-security,now 8.0.20-0ubuntu0.20.04.1 all [installed]
mysql-server-8.0/focal-updates,focal-security,now 8.0.20-0ubuntu0.20.04.1 AMD64 [installed]
mysql-server-core-8.0/focal-updates,focal-security,now 8.0.20-0ubuntu0.20.04.1 AMD64 [installed]
rsyslog/focal,now 8.2001.0-1ubuntu1 AMD64 [installed,automatic]
homeserver@ubuserv:~/Desktop$ Sudo apt -f install mysql-server
[Sudo] password for homeserver: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
mysql-server is already the newest version (8.0.20-0ubuntu0.20.04.1).
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
homeserver@ubuserv:~/Desktop$ Sudo apt -f install mysql-client
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  mysql-client
0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.
Need to get 9.424 B of archives.
After this operation, 110 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main AMD64 mysql-client all 8.0.20-0ubuntu0.20.04.1 [9.424 B]
Fetched 9.424 B in 1s (14,4 kB/s)       
Selecting previously unselected package mysql-client.
dpkg: warning: files list file for package 'mysql-server-8.0' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'mysql-common' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'mysql-client-core-8.0' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'mysql-server-core-8.0' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'mysql-client-8.0' missing; assuming package has no files currently installed
(Reading database ... 223970 files and directories currently installed.)
Preparing to unpack .../mysql-client_8.0.20-0ubuntu0.20.04.1_all.deb ...
Unpacking mysql-client (8.0.20-0ubuntu0.20.04.1) ...
Setting up mysql-client (8.0.20-0ubuntu0.20.04.1) ...
homeserver@ubuserv:~/Desktop$ dir
homeserver@ubuserv:~/Desktop$ cd ..
homeserver@ubuserv:~$ dir
Desktop  Documents  Downloads  Music  Pictures  Public  snap  Templates  Videos
homeserver@ubuserv:~$ cd Downloads
homeserver@ubuserv:~/Downloads$ dir
bprocessor-M11.Zip    ClientBridgeWorking.bin        RepeaterBridgeWorking3.bin
ClientBridgeWorking2.bin  mysql-apt-config_0.8.15-1_all.deb  teamviewer_15.5.3_AMD64.deb
homeserver@ubuserv:~/Downloads$ Sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb
Selecting previously unselected package mysql-apt-config.
dpkg: warning: files list file for package 'mysql-server-8.0' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'mysql-common' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'mysql-client-core-8.0' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'mysql-server-core-8.0' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'mysql-client-8.0' missing; assuming package has no files currently installed
(Reading database ... 223974 files and directories currently installed.)
Preparing to unpack mysql-apt-config_0.8.15-1_all.deb ...
Unpacking mysql-apt-config (0.8.15-1) ...
Setting up mysql-apt-config (0.8.15-1) ...
Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package mysql-apt-config)
OK
homeserver@ubuserv:~/Downloads$ Sudo service mysql status
Unit mysql.service could not be found.
homeserver@ubuserv:~/Downloads$ Sudo service mysql start
Failed to start mysql.service: Unit mysql.service not found.
homeserver@ubuserv:~/Downloads$ Sudo dpkg -P mysql
dpkg: warning: ignoring request to remove mysql which isn't installed
homeserver@ubuserv:~/Downloads$ Sudo apt-get install --reinstall mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 10 not upgraded.
Need to get 9.540 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main AMD64 mysql-server all 8.0.20-0ubuntu0.20.04.1 [9.540 B]
Fetched 9.540 B in 1s (17,6 kB/s)       
dpkg: warning: files list file for package 'mysql-server-8.0' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'mysql-common' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'mysql-client-core-8.0' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'mysql-server-core-8.0' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'mysql-client-8.0' missing; assuming package has no files currently installed
(Reading database ... 223979 files and directories currently installed.)
Preparing to unpack .../mysql-server_8.0.20-0ubuntu0.20.04.1_all.deb ...
Unpacking mysql-server (8.0.20-0ubuntu0.20.04.1) over (8.0.20-0ubuntu0.20.04.1) ...
Setting up mysql-server (8.0.20-0ubuntu0.20.04.1) ...

SU端子

homeserver@ubuserv:~/Desktop$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
homeserver@ubuserv:~/Desktop$ Sudo apt install synaptic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
synaptic is already the newest version (0.84.6ubuntu5).
The following packages were automatically installed and are no longer required:
  hplip-data printer-driver-postscript-hp python3-renderpm
  python3-reportlab python3-reportlab-accel
Use 'Sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
homeserver@ubuserv:~/Desktop$ synaptic
homeserver@ubuserv:~/Desktop$ Sudo su
root@ubuserv:/home/homeserver/Desktop# synaptic
root@ubuserv:/home/homeserver/Desktop# gksu synaptic

Command 'gksu' not found, did you mean:

  command 'gosu' from deb gosu (1.10-1)
  command 'ksu' from deb heimdal-clients (7.7.0+dfsg-1ubuntu1)
  command 'ksu' from deb krb5-user (1.17-6ubuntu4)

Try: apt install <deb name>

root@ubuserv:/home/homeserver/Desktop# gksu synaptic

Command 'gksu' not found, did you mean:

  command 'ksu' from deb heimdal-clients (7.7.0+dfsg-1ubuntu1)
  command 'ksu' from deb krb5-user (1.17-6ubuntu4)
  command 'gosu' from deb gosu (1.10-1)

Try: apt install <deb name>

root@ubuserv:/home/homeserver/Desktop# synaptic admin://
root@ubuserv:/home/homeserver/Desktop# xhost +si:localuser:root
localuser:root being added to access control list
root@ubuserv:/home/homeserver/Desktop# synaptic
^C
root@ubuserv:/home/homeserver/Desktop# synaptic
root@ubuserv:/home/homeserver/Desktop# synaptic
root@ubuserv:/home/homeserver/Desktop# synaptic
^C
root@ubuserv:/home/homeserver/Desktop# synaptic
root@ubuserv:/home/homeserver/Desktop# synaptic
root@ubuserv:/home/homeserver/Desktop# cd..
cd..: command not found
root@ubuserv:/home/homeserver/Desktop# cd ..
root@ubuserv:/home/homeserver# cd ..
root@ubuserv:/home# cd ..
root@ubuserv:/# cd ..
root@ubuserv:/# dir
bin    dev   lib    libx32  mnt   root  snap      sys  var
boot   etc   lib32  lost+found  opt   run   srv       tmp
cdrom  home  lib64  media   proc  sbin  swapfile  usr
root@ubuserv:/# Sudo aptitude install mysql-server
Sudo: aptitude: command not found
root@ubuserv:/# Sudo apt install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
mysql-server is already the newest version (8.0.20-0ubuntu0.20.04.1).
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
root@ubuserv:/# 

端末で発行されたコマンド

$ Sudo apt install mysql-server
$ Sudo mysql_secure_installation
$ Sudo mysql
$ Sudo apt remove mysql-server
$ Sudo apt install mariadb-server
$ Sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
$ Sudo service mysql restart
$ Sudo service mysql stop
$ Sudo service mysql start
$ systemctl status mariadb.service
$ set mysql/config/mysqld/innodb_force_recovery=1
$ systemctl start mariadb
$ find /etc -name *.cnf
$ Sudo apt-get purge mariadb-server
$ Sudo dpkg -l | grep mariadb
$ Sudo nano /etc/mysql/debian.cnf
$ Sudo mysql_secure_installation
$ apt-get purge mysql-server\*
$ rm -rf /etc/my.cnf /etc/mysql
$ Sudo apt-get remove --purge mysql*
$ Sudo apt-get purge mysql*
$ Sudo apt-get autoclean
$ Sudo apt-get remove dbconfig-mysql
$ Sudo apt-get remove ––purge mariadb-server
$ del mysql*
$ rm mysql*
$ Sudo apt-get clean
$ ps -A|grep mysql
$ Sudo pkill mysql
$ ps -A|grep mysqld
$ ps ax | grep mysql
$ Sudo nano sources.list
$ Sudo apt purge mariadb-*
$ Sudo rm -rf /usr/share/mysql/
$ find mariadb.repo
$ find mariadb*
$ apt search mysql | grep "\[install"
$ Sudo apt -f install mysql-server
$ Sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb

SUとして発行されたコマンド

# service mysql stop
# killall -KILL mysql mysqld_safe mysqld
# apt-get --yes purge mysql-server mysql-client
# apt-get --yes autoremove --purge
# apt-get autoclean
# deluser --remove-home mysql
# delgroup mysql
# rm -rf /etc/apparmor.d/abstractions/mysql /etc/apparmor.d/cache/usr.sbin.mysqld /etc/mysql /var/lib/mysql /var/log/mysql* /var/log/upstart/mysql.log* /var/run/mysqld
# updatedb
# rm ~/.mysql_history
# Sudo apt-get purge mariadb-server
# Sudo dpkg -l | grep mariadb
# Sudo apt-get purge mariadb-server 
# Sudo dpkg -l | grep mariadb 
# edit /etc/mysql/mysql.conf.d/mysqld.cnf
# killall -KILL mysql mysqld_safe mysqld
# apt-get --yes purge mysql-server mysql-client
# apt-get --yes autoremove --purge
# apt-get autoclean
# deluser --remove-home mysql
# delgroup mysql
# apt-get remove --purge mariadb
# apt-get remove --purge mariadb*
# Sudo rm -rf /etc/mysql/
# Sudo apt install mysql-server
# Sudo apt-get autoclean && Sudo apt-get --force-yes remove mysql-community-server-dbgsym mysql-community-server mysql-server
# xhost +si:localuser:root
# synaptic

更新

破損しているように見えるため、シナプスのLibmysqlclient21を削除しました。シナプスからMySQLを正常にアンインストールし、失敗して再インストールしようとしましたが、mysql-server-8.0のインストールを妨げる実行中のMySQLプロセスが見つからないようです。 (mysql-client、client-8.0、client-core-8.0、serverおよびserver-core-8.0は問題なく再インストールされます)。以下の画面キャプチャが表示されます https://Pastebin.ubuntu.com/p/pJCxYm5K2w/

また---

internal Error, No file name for mysql-server:AMD64
2
Mario

何が起こったのか理解できません。完全な管理者権限を持つユーザーアカウントを使用してubuntuマシンにリモートアクセスしていましたが、ubuntuのインストール時に作成されたアカウントではなかったので、ようやく直接コンピューターに直接アクセスしてログインしました。元のアカウントと驚いたことに、MySQLのシナプスを介してすべてのMySQLをアンインストールしようとしたときに、警告やエラーがまったく表示されず、安全な側で再生するために次のコマンドを実行しました。

# Sudo apt-get remove --purge mysql-server mysql-client mysql-common -y
# Sudo apt-get autoremove -y
# rm -rf /etc/mysql
# Sudo find / -iname 'mysql*' -exec rm -rf {} \;
# apt --fix-broken install

エラーや警告はまったくなかったので、私はsynapticを起動してmysql-serverを再インストールし(synapticが依存関係を処理しました)、インストールは正しく完了しました。完全な管理権限を持つユーザーアカウントには完全なアクセス権が必要なので、これは私には意味がありませんが、MySQLがインストールされて実行されています

0
Mario

MySQLのようですAPTリポジトリはmysql-commonしたがって、すべてのネイティブ8.0バージョンをアンインストールしますが、ここでは削除せずにアンインストールすることをお勧めします。

Sudo apt remove mysql-client-core-8.0 mysql-server-core-8.0 mysql-server-8.0 mysql-client-core-8.0 mysql-client-8.0 

その後、インストールを実行できるはずです。

Sudo apt install --reinstall mysql-community-client-core mysql-community-server-core mysql-common mysql-client mysql-server 

最後に、次のコマンドを実行して共有ライブラリを更新できます。

Sudo apt install libmysqlclient21

これにより、既存のバージョンが置き換えられます。

利用可能なパッケージのリストと詳細情報は here にあります。

1
mchid