Loading...
 

Installing MySQL on ESPRESSObin

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

Prerequisites


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


Now switch to the newly creted user account:

root@localhost:~# su - espresso


and configure hostname by editing /etc/hosts file:

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

 

Installing MySQL on Ubuntu 14.04


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):

espresso@localhost:~# sudo apt-get update
espresso@localhost:~# sudo apt-get install perl-base=5.18.2-2ubuntu1
espresso@localhost:~# sudo 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

 

 Note
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

Installing MySQL on Ubuntu 16.04


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):

espresso@localhost:~# sudo apt-get update
espresso@localhost:~# sudo apt-get install mysql-server
# Create a secure root password and remember it


Now we need to run the included security script to modify 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


No initializing of MySQL data directory is needed for Ubuntu 16.04.

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

espresso@localhost:~$ sudo service mysql status