Install MySQL on Ubuntu 18.04 Bionic Beaver Linux -

If you only wish to connect to MySQL server remotely but missing the mysql command you can install it my executing:
$ sudo apt install mysql-client

This is a companion discussion topic for the original entry at


Frederico Marinho

I don’t know why, when I tried to install mysql-server on Ubuntu 18.04 I had this error:

ERROR: Unable to start MySQL server:
mysqld: Can’t read dir of ‘/etc/mysql/conf.d/’ (Errcode: 2 - No such file or directory)
mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
Please take a look at 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-5.7 (–configure):
installed mysql-server-5.7 package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
mysql-server depends on mysql-server-5.7; however:
Package mysql-server-5.7 is not configured yet.

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:
E: Sub-process /usr/bin/dpkg returned an error code (1)

The solution is here:


Brand new 18.04 install. Followed all the instructions above. Can’t log in to mysql.

  • it is running
  • it has been restarted
  • I tried to login as both root and myself, but no joy :frowning:

I’m not a newbie to either Ubuntu or MySQL, but my systems are pretty stable, so I don’t do installs that often. I’m guessing I’m missing something super basic.

SOLVED: sudo solved it. sudo mysql -p -u root