question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(MySQL 8, WSL 2) su: warning: cannot change directory to /nonexistent: No such file or directory

See original GitHub issue

Hi Miguel, I just recently switched and moved my project files from WSL 1 to the WSL 2 environment.

Specs:

  • Ubuntu 20.04 LTS

  • Python 3.8.2

.

But I’m having problems starting MySQL in (venv) environment please see the below warning message. Is this an issue that you have seen in the past? When starting MySQL outside of (venv) it runs ok.

When I check if MySQL is installed in both inside and outside of (venv) environment the terminal says that they are installed in both.

(venv)$ sudo service mysql start
  * Starting MySQL database server mysqld
    su: warning: cannot change directory to /nonexistent: No such file or directory
    sleep: cannot read realtime clock: Invalid argument

$ sudo service mysql start
  * Starting MySQL database server mysqld

$ mysql --version
  mysql  Ver 8.0.21-0ubuntu0.20.04.4 for Linux on x86_64 ((Ubuntu))

(venv)$ mysql --version
  mysql  Ver 8.0.21-0ubuntu0.20.04.4 for Linux on x86_64 ((Ubuntu))

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

19reactions
krowecommented, Dec 11, 2021

I’ve just confirmed that this is still an issue on a fresh install. Someone has found a workaround for this issue:

sudo service mysql stop
sudo usermod -d /var/lib/mysql/ mysql
sudo service mysql start

This creates a home directory for the mysql user. The mysql user typically doesn’t have a home directory on purpose (I presume that this is because this prevents someone from logging in as that user). This shouldn’t be much of an issue for WSL installations unless you’re crazy enough to use WSL for a public facing server. In that case, your best bet is just starting the service twice.

Source: https://serverfault.com/questions/755763/mysql-nonexistent-home-vs-no-directory-logging-in-with-home/942422

10reactions
miguelgrinbergcommented, Aug 21, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

error: su: warning: cannot change directory to /nonexistent
mysql user is looking for a home directory, which seems to have not been assigned. To do that, you can execute:
Read more >
How to install MySQL on WSL 2 (Ubuntu) - Pen-y-Fan
How to install and configure MySQL 8.0 on WSL 2 (Ubuntu), ... su: warning: cannot change directory to /nonexistent: No such file or ......
Read more >
how to start mysql server on Ubuntu 20.04
I have Ubuntu installed via WSL 2 like so: Ubuntu 20.04.4 LTS ... su: warning: cannot change directory to /nonexistent: No such file...
Read more >
mysql 启动失败:su: warning: cannot change directory to ...
mysql 启动失败:su: warning: cannot change directory to /nonexistent: No such file or directory - 汪成龙的博客- 博客园
Read more >
error":"NonExistentPath: Data directory /data/db not found. C Code ...
mysql cannot change directory to /nonexistent ... mkdir: `hdfs://127.0.0.1:9000/user/hadoop': No such file or directory · tried accessing the FileTransfer ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found