Install MySQL on Ubuntu 18.04 Bionic Beaver Linux - LinuxConfig.org

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 https://linuxconfig.org/install-mysql-on-ubuntu-18-04-bionic-beaver-linux

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

====
The solution is here: https://askubuntu.com/questions/932662/trouble-reinstalling-mysql-5-7-after-uninstalling-on-ubuntu-16-04/1037771#1037771

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

Duh.