mysqld: Can't read dir of '/etc/mysql/conf.d/' (OS errno 2 - No such file or directory)
9,158
Open a terminal window and create the directory mentioned in the error message using mkdir
with p
option.
sudo mkdir -p /etc/mysql/conf.d/
p
option will create parent directories as well, in case they don't exist.
Create a new file mysql.cnf
in the above said directory and add [mysql]
. That can be done using tee
as well.
echo "[mysql]" | sudo tee /etc/mysql/conf.d/mysql.cnf
Finally try re-configuring packages using
sudo dpkg --configure -a
Note: A special thanks to Orphans for confirming the applicability of the answer in comments.
Author by
Tomáš Sidorják
Updated on September 18, 2022Comments
-
Tomáš Sidorják over 1 year
I am trying to install mysql-server by using
sudo apt-get install mysql-server
but apt says this: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)`
after doing configure on dpkg it says
# 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
-
thorstorm almost 4 yearsTry running
sudo apt update
and check for any errors and what it recommends. -
Tomáš Sidorják almost 4 yearsupdate is succesful but installation have same error
-
thorstorm almost 4 yearsHave you added ppas and other sources?
-
Tomáš Sidorják almost 4 yearsno, everything is still same as before
-
Kulfy almost 4 yearsAre you still facing the issue? If yes, open a terminal and run
sudo mkdir -p /etc/mysql/conf.d/
, thensudo nano mysql.cnf
and paste[mysql]
and save. Again runsudo nano mysqldump.cnf
and paste this. Save and retrysudo dpkg --configure -a
. If you still get errors ping me using@kulfy
in comments otherwise I may miss your comment. Thanks. -
Orphans about 3 years@Kulfy The paste that you linked to does not exist.
-
Kulfy about 3 years@Orphans Uh.. Oh!! Let me check if I can have contents of that file again. Also, please note that you need to create
mysql.cnf
in/etc/mysql/conf.d/
(I missedcd
ing in the comment). Can you please trysudo dpkg --configure -a
only without creatingmysqldump.conf
(i.e., only withmysql.cnf
) since I had no way to confirm that really worked? -
Orphans about 3 years@Kulfy Yeah I did try that, and it worked without the mysqldump.conf actually :) Thanks! You are a lifesaver
-
Kulfy about 3 years@Orphans Excellent!!! I'll post an answer for future visitors. (I can see a deleted answer posted by a new user who was also not able to find the paste :-()
-
-
Marc Vanhoomissen over 3 yearsMySQL was not started, as the output clearly say:
ERROR: Unable to start MySQL server: mysqld: Can't read dir of '/etc/mysql/conf.d/' (OS errno 2 - No such file or directory)
Why do you think any of your proposal would solve the problem?