Score:1

Error on realpath() on '/var/lib/mysql-files' (Error 2 - No such file or directory) - "mysql-files" directory doesn't exist

ge flag

I am using Ubuntu to configure Wordpress on WSL. Currently, I am trying to install MySQL as part of the LAMP Stack using the following as per this tutorial:

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

When I run the second command, I see "fail" in red appear (ie. mysql won't start). Here is what the Error Log looks like:

2021-09-05T08:17:59.936284Z mysqld_safe Logging to '/var/log/mysql/error.log'.
2021-09-05T08:17:59.951837Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysqld: Error on realpath() on '/var/lib/mysql-files' (Error 2 - No such file or directory)
2021-09-05T08:17:59.962000Z 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 1024 (requested 8161)
2021-09-05T08:17:59.962006Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 431 (requested 4000)
2021-09-05T08:18:00.172509Z 0 [Warning] [MY-011068] [Server] The syntax 'expire-logs-days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2021-09-05T08:18:00.172578Z 0 [ERROR] [MY-010095] [Server] Failed to access directory for --secure-file-priv. Please make sure that directory exists and is accessible by MySQL Server. Supplied value : /var/lib/mysql-files
2021-09-05T08:18:00.172626Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-09-05T08:18:00.178880Z mysqld_safe mysqld from pid file /run/mysqld/mysqld.pid ended

Here is what I get when I run the following commands:

root@DESKTOP-P44T17P:~# stat /var/lib/mysql-files
stat: cannot stat '/var/lib/mysql-files': No such file or directory
root@DESKTOP-P44T17P:~# grep user /etc/mysql/mysql.conf.d/mysqld.cnf
user            = mysql

It does not look the "mysql-files" directory exists.

Ubuntu 20.04.2

in flag
The tutorial you linked to is using Ubuntu 16.04. Did you adapt the commands for the more recent LTS version of Ubuntu's WSL image?
Wisely avatar
ge flag
@matigo No, I wasn't aware. Could that be the problem?
in flag
Perhaps. I've never installed the `lamp-server` package. Generally I do each part of the process individually and things "just work". [This guide from Digital Ocean](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04) is the only one I've seen online to be useful for most people. It's simple and straightforward.
Wisely avatar
ge flag
Okay, thanks. I'll give it a try.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.