Windows用Ubuntu 20.04 Bashにmysql-serverをインストール中にエラーが発生しました。

Windows用Ubuntu 20.04 Bashにmysql-serverをインストール中にエラーが発生しました。

間違えてすみません。 Stack Exchangeに初めて投稿しました。

Windows用Ubuntu Bashにインストールすると、MySQLでエラーが発生し、インストールが失敗します。 Stack Exchangeや他のサイトでいくつかの回答を見ましたが、その提案は問題を解決しません。

sudo apt cleanを実行し、MySQLを消去、更新、アップグレードし、dkpg --configure -aとsudo apt install -fを実行しました。それでも次のエラーが発生します。

Setting up mysql-server-8.0 (8.0.25-0ubuntu0.20.04.1) ...     
invoke-rc.d: could not determine current runlevel                                                                    
* Stopping MySQL database server mysqld                                                                     
[ OK ] Renaming removed key_buffer and myisam-recover options (if present)                                                 
Cannot open /proc/net/unix: No such file or directory                                                                
Cannot stat file /proc/1/fd/5: Operation not permitted                                                               
Cannot stat file /proc/1/fd/10: Operation not permitted                                                              
Cannot stat file /proc/1/fd/6: Operation not permitted                                                               
Cannot stat file /proc/6/fd/7: Operation not permitted                                                               
Cannot stat file /proc/6/fd/10: Operation not permitted                                                              
Cannot stat file /proc/6/fd/5: Operation not permitted                                                               
mysqld will log errors to /var/log/mysql/error.log                                                                   
mysqld is running as pid 4376                                                                                        
dpkg: error processing package mysql-server-8.0 (--configure):                                                        
installed mysql-server-8.0 package post-installation script subprocess returned error 
exit status 1                 
No apport report written because the error message indicates its a followup error from a previous failure.                                                                                                                     
dpkg: dependency problems prevent configuration of mysql-server:                                                                 
mysql-server depends on mysql-server-8.0; however:                                                                    
Package mysql-server-8.0 is not configured yet.                                                                                                                                                                                         
dpkg: error processing package mysql-server (--configure):                                                            
dependency problems - leaving unconfigured                                                                          
Processing triggers for man-db (2.9.1-1) ...                                                                         
Processing triggers for sgml-base (1.29.1) ...                                                                       
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...                                                               
Errors were encountered while processing:                                                                             
mysql-server-8.0                                                                                                     
mysql-server                                                                                                        
E: Sub-process /usr/bin/dpkg returned an error code (1) 

/var/log/mysql/error.log は以下を示しています:

2021-07-01T16:03:10.840389Z 0 [ERROR] [MY-010262] [Server] 
Can't start server: Bind on TCP/IP port: Address already in use                                                                                                                   
2021-07-01T16:03:10.840489Z 0 [ERROR] [MY-010257] [Server] 
Do you already have another mysqld server running on port: 3306 ?                                                                                                                 
2021-07-01T16:03:10.840710Z 0 [ERROR] [MY-010119] [Server] 
Aborting  

mysqldサービスを停止できません。試してみると、Ubuntuではサービスとして認識されないと言いました。

Ubuntu 18.04 LTS:MySQL 8.0サーバーへの依存関係のインストールに関する問題それも無駄です。

ベストアンサー1

ここの指示に従ってください:https://stackoverflow.com/questions/62127891/cant-install-mysql-on-pure-ubuntu-20-04


sudo apt-get purge mysql*

sudo apt-get autoremove

sudo apt-get autoclean

sudo apt-get remove dbconfig-mysql

sudo apt-get dist-upgrade 

//This successfully removed it and I was able to install:
sudo apt update

sudo apt install mysql-server

sudo mysql_secure_installation

ただし、起動せずに Can't connect to local MySQL server through socketエラーが発生します。同じ問題に対する解決策があります。

「Ubuntuでは、私は次のことをしました:

sudo mysqld_safe --skip-grant-tables --skip-syslog --skip-networking

次に、新しい端末でmysqlを実行します。

mysql -u root パスワードを変更するには、次のクエリを実行してください。

FLUSH PRIVILEGES;

MySQL 5.7では、mysql.userテーブルフィールドのパスワードフィールドが削除され、フィールド名は「authentication_string」になりました。

回答を引用した後、PASSWORD()関数はこの回答で共有されており、廃止されました。そこで指定されているように、私が使用するMySQL暗号化関数MD5()に置き換えます。

ついに:

* Starting MySQL database server mysqld                     [ OK ]

「セーフモードで実行する前に、次のように/var/run/mysqldディレクトリを作成する必要がありました。これらディレクティブを作成し、すべてのコマンドにプレフィックスを追加しますsudo

おすすめ記事