我正在使用 Ubuntu 在 WSL 上配置 Wordpress。目前,我正在尝试按照以下步骤将 MySQL 安装为 LAMP Stack 的一部分本教程:
sudo usermod -d /var/lib/mysql/ mysql
sudo service mysql start
当我运行第二条命令时,我看到出现红色的“失败”(即 mysql 无法启动)。错误日志如下所示:
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
这是我运行以下命令时得到的结果:
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
看起来“mysql-files”目录不存在。
Ubuntu 20.04.2