如何修复 "Could not open required defaults file: /usr/local/ampps/mysql/etc/my.cnf" 错误?

How to fix "Could not open required defaults file: /usr/local/ampps/mysql/etc/my.cnf" error?

当我尝试 运行: sudo service mysqld start 我收到以下错误:

Could not open required defaults file: /usr/local/ampps/mysql/etc/my.cnf Fatal error in defaults handling. Program aborted
Starting MySQL.The server quit without updating PID file(/[FAILED]l/ampps/var/mysqld.pid).

我试过检查 my.cnf 是否存在,然后它退出了。

我在 Artix Linux 中也有这个问题,要解决它只需创建包含以下内容的文件 my.cnf

[mysqld]
basedir=/usr
datadir=/var/lib/mysql
user=mysql
pid-file=/run/mysqld/mysqld.pid

之后我就可以 运行 mysqld 服务了。我不知道在 Fedora 中你必须在哪里创建它,在我的例子中是在目录 /etc/mysql 中,但在你的例子中我猜它会在 /usr/local/ampps/mysql/etc 中。希望对您有所帮助。