我正在尝试使用安装 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
那么它工作正常。