First of all, follow this steps: https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-16-04
Its necessary to set a root password
- Stop MySQL
sudo /etc/init.d/mysql stop
- Change mysql's inicialization file
/etc/init.d/mysql:109 -> --skip-grant-tables
- Start MySQL again
sudo /etc/init.d/mysql start
- In case of use gem mysql2, run
sudo apt-get install libmysqlclient-dev
because it is a dependency
zcat ~/dump/dump.sql.gz| mysql -uroot -p database_name