Mysql 显示错误 /etc/profile.d/wsl-integration.sh: 无法创建 //.cache/wslu/integration: DirectoryWSL: Ubuntu

Mysql 显示错误 /etc/profile.d/wsl-integration.sh: 无法创建 //.cache/wslu/integration: DirectoryWSL: Ubuntu

我在 WSL:Ubuntu 18.04 中安装 mysql,当我重新启动 mysql 时sudo service mysql restart显示错误:

No directory, logging in with HOME=/
mkdir: cannot create directory ‘//.cache’: Permission denied
-su: 20: /etc/profile.d/wsl-integration.sh: cannot create //.cache/wslu/integration: Directory nonexistent

然后尝试修改文件 /etc/profile.d/wsl-integration.sh

# Check if we have HOME folder
if [[ "${HOME}" == "/" ]]; then
  exit 0
fi

但它不起作用...并显示错误:

No directory, logging in with HOME=/
-su: 2: /etc/profile.d/wsl-integration.sh: [[: not found
mkdir: cannot create directory ‘//.cache’: Permission denied
-su: 23: /etc/profile.d/wsl-integration.sh: cannot create //.cache/wslu/integration: Directory nonexistent

如何解决这个问题?谢谢......

答案1

.cache/wslu/integration也许您可以在 中找到该文件/home/<your_name>/。在那里,您可以/etc/profile.d/wsl-integration.sh像这样修改该文件:

HOME=/home/your_name

并删除检查${HOME}

相关内容