Note: These instructions are for Ubuntu x64 and if you are using 32bit distribution you’ll have to download 32bit packages. Also – there might me newer packages for the software you are installing so check it out before doing this. We will be installing MySQL binary edition.
If you are planning to install latest MySQL server on Ubuntu my recommendation is to first install regular MySQL 5.1. server. Don’t install meta packages, just install essentials and their dependencies. You don’t have to configure MySQL except during installation.
sudo apt-get install mysql-server-5.1 mysql-client-5.1 mysql-client-core-5.1 php5-mysql
If you are using desktop distribution like me and want to have MySQL Workbench go to this page and download “mysql-workbench-gpl-5.2.37-1ubu1104-amd64.deb”. Open it with Debi package manager and install all dependencies. Although I have tried a lot I couldn’t install MySQL Workbench from sources on this version of Ubuntu so this step is essential before upgrading MySQL to v5.6.4.
Next step would be to uninstall MySQL server. Note – you don’t want to “purge” mysql installation because it would remove all dependencies and you don’t want to remove mysql-client because MySQL Workbench need it! So – just open Synaptic Package Manager and only remove mysql-server-5.1 and nothing else.
Now you can download “mysql-5.6.4-m7-linux2.6-x86_64.tar.gz” from this page. Just select “MySQL Community Server” and on next page tab “Development Releases” and you’ll find at the bottom Linux Generic Tar Archive of server. After this you can follow simple steps described below.
sudo su cp /your/download/location/mysql-5.6.4-m7-linux2.6-x86_64.tar.gz /usr/local/mysql.tar.gz cd /usr/local tar zxvf mysql.tar.gz rm mysql.tar.gz ln -s mysql-5.6.4-m7-linux2.6-x86_64 mysql cd mysql chown -R mysql . chgrp -R mysql . scripts/mysql_install_db --user=mysql chown -R root . chown -R mysql data rm /etc/mysql/my.cnf cp support-files/my-medium.cnf /etc/mysql/my.cnf cp support-files/mysql.server /etc/init.d/mysql update-rc.d mysql defaults nano /etc/environment # add this to the end of string ":/usr/local/mysql/bin"
It is essential that you reboot your server now. After rebooting open terminal and continue.
sudo su service mysql stop mkdir /var/run/mysqld touch /var/run/mysqld/mysqld.sock chown -R mysql:mysql /var/run/mysqld nano /etc/mysql/my.conf # replace all "/tmp/mysql.sock" with "/var/run/mysqld/mysqld.sock" service mysql start cd /usr/local/mysql/bin mysql_secure_installation # complete installation answering simple questions and securing installation
All that is left now is to test your installation, MySQL Server and Workbench. If you followed all steps you shouldn’t have any problems. I can confirm that this version of MySQL is more advanced, faster and better and I am using it on my production servers.