Installing MySQL on ESPRESSObin

This tutorial will show how to install MySQL on ESPRESSObin running Ubuntu 14.04.


To install MySQL first we need to add a sudo non-root user (we will name our user espresso) on ESPRESSObin. We do this with:

root@localhost:~# adduser espresso

After configuring password and user information, enter usermode to add the newly created user to the sudo group:

root@localhost:~# usermod -aG sudo espresso

and test sudo access on new user account, e.g. with:

# first switch to new user account
root@localhost:~# su - espresso
# for example list contents of /root dir which is only accessible to root user
espresso@localhost:~$ sudo ls -la /root
[sudo] password for espresso:
total 76
drwx------  6 root root 4096 Jan  1 03:52 .
drwxr-xr-x 21 root root 4096 Mar 10  2017 ..
-rw-------  1 root root  990 Jan  1 01:34 .bash_history
-rw-r--r--  1 root root 3106 Feb 20  2014 .bashrc
drwx------  2 root root 4096 Jan  1 01:00 .cache
-rw-r--r--  1 root root   58 Jan  1  1970 .gitconfig
-rw-r--r--  1 root root  140 Feb 20  2014 .profile

and configure hostname by editing /etc/hosts file:

espresso@localhost:~$ sudo vim /etc/hosts
# Insert following lines in the file localhost.localdomain localhost


Installing MySQL

To install MySQL on Ubuntu 14.04. install the following (we will need to downgrade to perl-base 5.18.2-2ubuntu1 to fix necessary dependencies):

root@localhost:~# apt-get update
root@localhost:~# apt-get install perl-base=5.18.2-2ubuntu1
root@localhost:~# apt-get install mysql-server-5.6
# Create a secure root password and remember it

Now we need to run the included security script to modify certain less secure options such as remote root logins and sample users:

root@localhost:~# mysql_secure_installation
# Enter root password from before
# There is no need to change the root password since we have already set it up
# You can press Enter to accept defaults for other questions

Next thing we need to do is to initialize MySQL data directory. On MySQL versions earlier than 5.7.6 we do this with:

root@localhost:~# mysql_install_db



If experiencing FATAL ERROR: Could not find my-default.cnf., copy /etc/mysql/my.cnf configuration file to /usr/share/mysql/, rename it to my-default.cnf and rerun above command:

root@localhost:~# cp /etc/mysql/my.cnf /usr/share/mysql/my-default.cnf
root@localhost:~# mysql_install_db

MySQL should now automatically start. Lastly, check that the service is running with:

espresso@localhost:~$ sudo service mysql status
mysql start/running, process 1780

And that is it for now, you have successfully installed MySQL on ESPRESSObin. Same instructions from above can also be seen on the video below: