
我透過 WSL 2 安裝了 Ubuntu,如下所示:Ubuntu 20.04.4 LTS (GNU/Linux 5.10.102.1-microsoft-standard-WSL2 x86_64)
我正在嘗試使用此命令安裝 mysql-server,“sudo apt install mysql-server”
(https://ubuntu.com/server/docs/databases-mysql)
我安裝它
mysql --version
mysql Ver 8.0.31-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))
但此後它不會開始。
(base) bluetail14@LAPTOP-28BMMQV7:~$ sudo service mysql start
* Starting MySQL database server mysqld
(base) bluetail14@LAPTOP-28BMMQV7:~$ sudo service mysql restart [ OK ]
* Starting MySQL database server mysqld su: warning: cannot change directory to /nonexistent: No such file or directory
我嘗試過一組這些命令:
這一項是更改主目錄。
(base) bluetail14@LAPTOP-28BMMQV7:~$ sudo usermod -d /var/lib/mysql/ mysql
usermod: user mysql is currently used by process 3622
(base) bluetail14@LAPTOP-28BMMQV7:~$ sudo systemctl stop mysql.service
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
(base) bluetail14@LAPTOP-28BMMQV7:~$ sudo usermod -d /var/lib/mysql/ mysql
usermod: user mysql is currently used by process 3622
(base) bluetail14@LAPTOP-28BMMQV7:~$ sudo systemctl start mysql.service
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
所以看來我需要配置一個不存在的主目錄或其他目錄?我怎樣才能正確設定它?