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 3 months
I am trying to install mysql-server by using
sudo apt-get install mysql-serverbut 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 over 2 yearsTry runningsudo apt updateand check for any errors and what it recommends. -
Tomáš Sidorják over 2 yearsupdate is succesful but installation have same error
-
thorstorm over 2 yearsHave you added ppas and other sources? -
Tomáš Sidorják over 2 yearsno, everything is still same as before
-
Kulfy over 2 yearsAre you still facing the issue? If yes, open a terminal and runsudo mkdir -p /etc/mysql/conf.d/, thensudo nano mysql.cnfand paste[mysql]and save. Again runsudo nano mysqldump.cnfand paste this. Save and retrysudo dpkg --configure -a. If you still get errors ping me using@kulfyin comments otherwise I may miss your comment. Thanks. -
Orphans almost 2 years@Kulfy The paste that you linked to does not exist. -
Kulfy almost 2 years@Orphans Uh.. Oh!! Let me check if I can have contents of that file again. Also, please note that you need to createmysql.cnfin/etc/mysql/conf.d/(I missedcding in the comment). Can you please trysudo dpkg --configure -aonly without creatingmysqldump.conf(i.e., only withmysql.cnf) since I had no way to confirm that really worked? -
Orphans almost 2 years@Kulfy Yeah I did try that, and it worked without the mysqldump.conf actually :) Thanks! You are a lifesaver -
Kulfy almost 2 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 about 2 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?