![mysqld:无法读取“/etc/mysql/conf.d/”的目录(OS errno 2 - 没有此文件或目录)](https://linux22.com/image/1206195/mysqld%EF%BC%9A%E6%97%A0%E6%B3%95%E8%AF%BB%E5%8F%96%E2%80%9C%2Fetc%2Fmysql%2Fconf.d%2F%E2%80%9D%E7%9A%84%E7%9B%AE%E5%BD%95%EF%BC%88OS%20errno%202%20-%20%E6%B2%A1%E6%9C%89%E6%AD%A4%E6%96%87%E4%BB%B6%E6%88%96%E7%9B%AE%E5%BD%95%EF%BC%89.png)
我正在尝试使用安装 mysql-server,sudo apt-get install mysql-server
但是 apt 说:
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-8.0
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)`
在 dpkg 上进行配置后,它说
# sudo dpkg --configure -a
Setting up mysql-server-8.0 (8.0.20-0ubuntu0.20.04.1) ...
Renaming removed key_buffer and myisam-recover options (if present)
ERROR: Unable to start MySQL server:
mysqld: Can't read dir of '/etc/mysql/conf.d/' (OS errno 2 - No such file or directory)
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
Please take a look at https://wiki.debian.org/Teams/MySQL/FAQ for tips on fixing common upgrade issues.
Once the problem is resolved, run apt-get --fix-broken install to retry.
dpkg: error processing package mysql-server-8.0 (--configure):
installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-8.0; however:
Package mysql-server-8.0 is not configured yet.
dpkg: error processing package mysql-server (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
mysql-server-8.0
mysql-server
答案1
答案2
在我的例子中,mysql 服务器尚未启动,因此使用以下命令之一运行服务器:
五种开始方式:
1. Start MySQL Server
2. sudo service mysql start.
3. sudo /etc/init.d/mysql start.
4. sudo systemctl start mysqld.
5. mysqld.
然后尝试使用 mysql 客户端连接
mysql -u username -p
那么它工作正常。